need help with game

Robin Munn rmunn at pobox.com
Wed Apr 2 14:24:30 EST 2003


BBFoto <bbfoto2002 at netscape.net> wrote:
> I apologize for top posting.  I clicked on "Followup Usenet Message".
> My mistake was unintentional.  I will try to find out more about it as
> was suggested.  And as to why I tried to execute a .pyc file:  If I
> knew what I was doing, then I would do it right.  I do appreciate all
> attempts to help.
> 
> I did a search on the PySol directory.  Nowhere is there a file called
> "PySol.py".  There is a series of files in sequence named
> "PySol_15.pyc"  "PySol_16.pyc"  "PySol_20..pyc"  "PySol_21.pyc" and
> "PySol_22.pyc".
> 
> 
> I tried to execute this line,
>  
> execfile('c:/program files/pysol/pysol-4.80/data/PySol_22.pyc') 
> 
> The path is correct.  After it failed I copied this error message from
> the Dos screen:
> 
>   File "c:/program files/pysol/pysol-4.80/data/PySol_22.pyc", line 1
>     -_
>      ^
> SyntaxError: invalid syntax

What the execfile() function does is read a Python source file and run
it. You're getting a SyntaxError because .pyc files are not Python
source files. Python source files end in .py; when the Python
interpreter first runs a .py file, it will byte-compile the file, then
save the .pyc for later reference. That's what those .pyc files are:
byte-compiled files created with various versions of Python.

What icon do you show for those .pyc files? What happens when you
double-click on PySol_22.pyc?

-- 
Robin Munn <rmunn at pobox.com>
http://www.rmunn.com/
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838




More information about the Python-list mailing list