Skip to main content

syntax error while tringtrying to execute python program in bash shell

I'm trying to use python to read in data from a text file but I keep getting "syntax" errors when I execute the program.

Python Code: Test.py

import os
import numpy as np

Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt",unpack=True)
print Ye
print Tb

noteNote: I've also used the np.loadtxt function with the same result.

Once I save my program, I go to my bash shell and run it with:

./Test.py

After about a minute and a half I get back the following errors:

./Test.py: line 6: syntax error near unexpected token `('
./Test.py: line 6: `Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt", unpack=True)'

I've looked up documentation on the loadtxt and genfromtxt functions and everything I've seen says that the python is correct, so I have no idea what is going wrong or how to fix it.

syntax error while tring to execute python program in bash shell

I'm trying to use python to read in data from a text file but I keep getting "syntax" errors when I execute the program.

Python Code: Test.py

import os
import numpy as np

Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt",unpack=True)
print Ye
print Tb

note I've also used the np.loadtxt function with the same result.

Once I save my program, I go to my bash shell and run it with:

./Test.py

After about a minute and a half I get back the following errors:

./Test.py: line 6: syntax error near unexpected token `('
./Test.py: line 6: `Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt", unpack=True)'

I've looked up documentation on the loadtxt and genfromtxt functions and everything I've seen says that the python is correct, so I have no idea what is going wrong or how to fix it.

syntax error while trying to execute python program in bash shell

I'm trying to use python to read in data from a text file but I keep getting "syntax" errors when I execute the program.

Python Code: Test.py

import os
import numpy as np

Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt",unpack=True)
print Ye
print Tb

Note: I've also used the np.loadtxt function with the same result.

Once I save my program, I go to my bash shell and run it with:

./Test.py

After about a minute and a half I get back the following errors:

./Test.py: line 6: syntax error near unexpected token `('
./Test.py: line 6: `Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt", unpack=True)'

I've looked up documentation on the loadtxt and genfromtxt functions and everything I've seen says that the python is correct, so I have no idea what is going wrong or how to fix it.

Source Link

syntax error while tring to execute python program in bash shell

I'm trying to use python to read in data from a text file but I keep getting "syntax" errors when I execute the program.

Python Code: Test.py

import os
import numpy as np

Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt",unpack=True)
print Ye
print Tb

note I've also used the np.loadtxt function with the same result.

Once I save my program, I go to my bash shell and run it with:

./Test.py

After about a minute and a half I get back the following errors:

./Test.py: line 6: syntax error near unexpected token `('
./Test.py: line 6: `Ye,Eb,Tb = np.genfromtxt("ye_tnuebar_table.txt", unpack=True)'

I've looked up documentation on the loadtxt and genfromtxt functions and everything I've seen says that the python is correct, so I have no idea what is going wrong or how to fix it.