I have an imported function from a separate file I have previously created.
In it I declare the variable nums
to be nonlocal
and then work with it. So with that context I will give you a snippet of my code and my error.
cwd = os.getcwd()
sys.path.append(os.path.abspath(cwd + "/myfunctions"))
from opening_questions import opening_questions
def runing_app():
nums = []
opening_questions()
def core_app(jpm):... # this is what I am trying to execute from all this.
for jpm in nums:
core_process = multiprocessing.Process(target=core_app, args=(jpm,))
core_process.start()
print('RAN')
break
runing_app()
In opening_questions()
I declare nonlocal nums
and try to work with nums
inside my function.
This is the error I get:
Traceback (most recent call last):
File "/home/gdfelt/Python projects/test versions/test(current work)/testX.py", line 22, in <module>
from opening_questions import opening_questions
File "/home/gdfelt/Python projects/test versions/test(current work)/myfunctions/opening_questions.py", line 19
nonlocal nums
SyntaxError: no binding for nonlocal 'nums' found
This code ran just fine before I ran it from a separate file. What do I need to have this code work? I'm using python 3.5 -- if you need clarification, please ask.