I am trying to read a file name stored as a string in a data file. No problem there. If I pass it to genfromtxt I get error "IOError: Z:\Python\Rb input.txt not found." if I put the file name into genfromtxt explicitly it works
this fails with error "IOError: Z:\Python\Rb input.txt not found."
import numpy
modat = open('z:\python\mot1 input.txt') # open file with names in
rbfile = modat.readline() # read data file name
print rbfile # print the file name
rb = numpy.genfromtxt(rbfile, delimiter =',')
print rb
but his works
import numpy
modat = open('z:\python\mot1 input.txt') # open file with names in
rbfile = modat.readline() # read data file name
print rbfile
rb = numpy.genfromtxt('z:\python\Rb input.txt', delimiter =',')
print rb
the 2 print statements give
%run "c:\users\ian\appdata\local\temp\tmpkiz1n0.py"
Z:\Python\Rb input.txt
[[ 2. 10.]
[ 3. 11.]
[ 5. 13.]
[ 10. 15.]
[ 15. 16.]
[ 20. 16.]
[ 30. 22.]]
It appears to be to do with now the string is passed - any suggestions please