Click here to Skip to main content
15,888,236 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have written a script for that but not working properly yet. Can you help me to fix it? I appreciate it.
The problem solved for having the script properly but now how should I run it?
I have these files in the directory:
Jlim_to_corelim.py  __pycache__  cum.py  minuit_functions.py  output  profile_ll.py  setup.py  ven.py  xsec_to_Jlim.py


What I have tried:

after running my script, it gives me an error:

Traceback (most recent call last):

File "ven.py", line 9, in <module>

f.close()

NameError: name 'f' is not defined

--------------------------------------------------------------------------

my python script at ubuntu:

Python
import numpy as np

h =open('profile_ll.py','r')

h_contents = h.read()

if h_contents.find('self.binspec') == 57: #line 57 has self.binspec

     f = open('binspec')

     for lines in f:

          print(lines)

          sck.send('PRIVMSG ' + chan + " " + lines)

f.close()
Posted
Updated 14-Jun-19 12:55pm
v4
Comments
Patrice T 14-Jun-19 3:52am    
What error, where ?
[no name] 14-Jun-19 13:00pm    
NameError: name 'f' is not defined
Richard MacCutchan 14-Jun-19 5:02am    
Please add <pre> tags around your code and format it correctly.

1 solution

Try:
Python
import numpy as np

h =open('profile_ll.py','r')

h_contents = h.read()

if h_contents.find('self.binspec') == 57: #line 57 has self.binspec

     f = open('binspec')

     for lines in f:

          print(lines)

          sck.send('PRIVMSG ' + chan + " " + lines)

     f.close()

Indentation matters in Python.
 
Share this answer
 
Comments
[no name] 14-Jun-19 18:28pm    
how can I run it?
I have these files:
Jlim_to_corelim.py __pycache__ cum.py minuit_functions.py output profile_ll.py setup.py ven.py xsec_to_Jlim.py
Patrice T 14-Jun-19 18:42pm    
Sorry, I don't use Python
[no name] 18-Jun-19 8:18am    
simply the best solution, thnx
Patrice T 18-Jun-19 8:24am    
Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900