Reputation: 235
I am totally new to Linux, python, and tensorflow. I am having a problem to get a data from a separate text file. Python codings are as below.
import tensorflow as tf
import numpy as np
xy=np.loadtxt('train.txt',unpack=True, dtype='float32')
x_data=xy[0:-1]
y_data=xy[-1];
print 'x',x_data
print 'y',y_data
and error messages are as below.
root@bu-R470-R420:/home/bu# source ~/tensorflow/bin/activate
tensorflow)root@bu-R470-R420:/home/bu# python -m tensorflow.linearLoad
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/root/tensorflow/lib/python2.7/site-packages/tensorflow/linearLoad.py", line 5, in <module>
xy=np.loadtxt('train.txt',unpack=True, dtype='float32')
File "/root/tensorflow/local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 803, in loadtxt
fh = iter(open(fname, 'U'))
IOError: [Errno 2] No such file or directory: 'train.txt'
(tensorflow)root@bu-R470-R420:/home/bu#
Since i have been using Windows OS, Coding in Linux is a quite nightmare. Please help me out.
Upvotes: 1
Views: 1951
Reputation: 2174
The IOError
exception you are receiving means the file train.txt
doesn't exist in the relative path.
The error message clearly shows it:
IOError: [Errno 2] No such file or directory: 'train.txt'
Double check the file train.txt
is present in the folder from which you are running your script, /home/bu
in your case.
Upvotes: 3