Passing filename dynamically #8
Hi,
We are trying to pass the filename dynamically in 'make_clustergrammer.py', each call the text file name will be different.
fileName = sys.argv[1:]
loadFile = ''.join(fileName)
decoded_string = bytes(loadFile, "utf-8").decode("unicode_escape") # python3
# load matrix tsv file
tempassign = decoded_string.replace('\"','')
confilename = 'txt/' + tempassign + '.' + 'txt'
print(confilename )
net.load_file(confilename)
Error which I'm getting as follows,
FileNotFoundError: [Errno 2] No such file or directory: 'txt/.txt'
1 . assigned variable is empty 2. I m communicating python script from nodejs.
Pls help me out, i got stuck with this more than a week.
Really, this clustergrammer is what needed exactly for our project.
We using MEAN(MongoDb, ExpressJS, Angular 4, NodeJs).
Actual prob is when i assign the argv[1:] to a variable and use that variable as parameter for 'net.load_file('filename')', it is empty.
Hard code:
Thanks in advance.
Are you able to print the fileconname on line 15 in your second screenshot?
Yes, it is printing the value. But when i pass it as argument in next line, it is empty.
Add these lines above net.load_file():
print (fileconname)
sys.exit()
And post the output here.
Pls find the code and result screenshots,
Note 1: sys.exit( ) terminating the script, i need to load the file and write json file further. I think in order to see the exact line you asking me to terminate the script.
Note 2: Actually before executing the python script, i m creating the txt file in "D" drive.
Thanks in advance.