I do that without the IDE:
$ ipython
$ edit file.py
$ :x (save and close)
It executes Python code, but not the one, where I use Pygame. It gives:
WARNING: Failure executing file:
In the IDE, my code executes.
-
If something doesn't work in
ipython
, try the real Python interpreter (justpython
);ipython
has known bugs, and not infrequently code known to work in the real interpreter fails there.On UNIXlike platforms, your script should start with a shebang -- that is, a line like the following:
#!/usr/bin/env python
should be the very first line (and should have a standard UNIX line ending). This tells the operating system to execute your code with the first python interpreter found in the
PATH
, presuming that your script has executable permission set and is invoked as a program.The other option is to start the program manually -- as per the following example:
$ python yourprogram.py
...or, to use a specific version of the interpreter (if more than one is installed):
$ python2.5 yourprogram.py
0 comments:
Post a Comment