I am running this script (parent.py
)
import sys
sys.path.append('/python/loanrates/test')
import test2
test2
from this directory:
D:\python\loanrates\Parent
Which opens this script (test.py
)
import json
data = 'ello world'
with open( 'it_worked.json', 'w') as f:
json.dump(data, f)
From this directiory
D:\python\loanrates\test
When I run parent.py
which consequentially runs test.py
I want the json.dump to save in D:\python\loanrates\test' currently it saves in
D:\python\loanrates\Parent`
EDIT: I have made the following edits:
This is now the child file:
import json
def main():
data = 'ello world'
print data
with open( 'D:/python/loanrates/test/it_worked.json', 'w') as f:
json.dump(data, f)
if __name__ == '__main__':
main()
And this is my parent:
import sys
import thread
sys.path.append('/python/loanrates/test')
import test2
thread.start_new_thread(test2.main())
I get this error:
TypeError: start_new_thread expected at least 2 arguments, got 1
What is the second argument i need to put in ?