[Tutor] Using python 3 on Ubuntu 14.04
Alex Kleider
akleider at sonic.net
Wed Dec 23 18:10:44 EST 2015
On 2015-12-23 14:58, Jim Byrnes wrote:
> I am in the process of moving from unbutu 12.04 to 14.04. I was doing
> some testing and got this:
>
> jfb at Jims-1404:~$ cd MyProgs
> jfb at Jims-1404:~/MyProgs$ cd passwords
> jfb at Jims-1404:~/MyProgs/passwords$ python3 passwords.py
> Traceback (most recent call last):
> File "passwords.py", line 8, in <module>
> from PythonCard import model,clipboard
> ImportError: No module named 'PythonCard'
>
> If I simply start it with python passwords.py it runs fine. There is
> no need to use python 3 on this particular program but if I wanted to
> write for python 3 in the future what do I need to do to run programs
> with it?
>
> Thanks, Jim
Jim, make
#!/usr/bin/env python3
the very first line in your myscript.py file
and change it's permissions with the following command:
chmod 775 myscript.py
Then you'll be able to run it simply by entering
./password.py
on the command line.
PS I don't think this will fix your current problem which is
probably the result of importing something that exists with
Python 2 but not 3- specifically PythonCard.
More information about the Tutor
mailing list