INeedHelp
INeedHelp

Reputation: 1

Ubuntu 12.04 How To Run Python 3.3.2 Program In Terminal

OK so for school I am having to set up a computer using Ubuntu 12.04 to run Python programs written in Python 3.3. I was aware that 12.04 came with Python 3.2, so I followed the procedure in the first reply in this thread to install Python 3.3:

Now when I open the Terminal, I type ~/bin/py to get it to display the following at the top of the terminal:

Python 3.3.2 (default, Dec 10 2013, 11:35:01)
[GCC 4.6.3] on Linux
Type "help", "copyright", "credits", or "license" for more information.
>>>

So far so good. Now I am having trouble replicating the functionality of the same Python program that I execute as follows on my Windows laptop.

(This is what I type in the Python commandline on windows)

import filereader 
from filereader import * 
reader = filereader("C:\Python33\ab1copy.ab1") 
reader.show_entries()

The end result is a directory of data types found in the file. The filereader class is located in Python33\Lib\site-packages\filereader.py in the above example. On the Ubuntu computer its location is Python-3.3.2\Lib\site-packages\filereader.py. Also on Ubuntu, the ab1copy.ab1 file is located in the home directory for now.

After I achieve the recognition of Python 3.3.2 in the Ubuntu Terminal as noted above, how can I replicate my program's functionality there? If I try to put in the same first command "import filereader" I get the following error:

>>>import filereader
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'filereader'

Upvotes: 0

Views: 985

Answers (2)

Yacine Bs
Yacine Bs

Reputation: 312

try this in the terminal

python3 your_file.py

Upvotes: 1

johannestaas
johannestaas

Reputation: 1225

It's probably not in your python path.

Check this to see where it looks for your source:

import sys
print(sys.path)

Upvotes: 0

Related Questions