ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-tutor
python-tutor
Re: [Tutor] Version of a .pyc file
by Don Taylor other posts by this author
Apr 19 2006 6:50PM messages near this date
Re: [Tutor] Version of a .pyc file | Re: [Tutor] Version of a .pyc file
Terry Carroll wrote:

> >How can I tell if a .pyc file was built with 2.3 or 2.4?
>  
>  
>  There's a "Magic Number" in the first 2 or 4 bytes, (depending on whether 
>  you consider the \r\n part of the MN).
>  
>  
> >>>f = open("pycfile.pyc", "rb")
> >>>magictable = {'\x3b\xf2\r\n': "2.3", '\x6d\xf2\r\n' : "2.4"}
> >>>magic = f.read(4)
> >>>release = magictable.get(magic,"unknown")
> >>>print "Python release:", release
>  
>  Python release: 2.4
>  

I have used Terry's code to write a script to find all of the the .pyc 
files on my system that were compiled with the 2.3 version of the 
compiler, and I have removed these files.

But my underlying problem still occurs: somewhere somebody is calling 
for the 2.3 version of the Python vm .dll and not finding it.  This is 
happening under Pydev/Eclipse and my only recourse is to blow Eclipse 
away using Task Manager.

So maybe I have  a .pyd file somewhere that is a 2.3 extension.

Is there a way to examine .pyd files to see if they were built for 
Python 2.3?

Finally, are there any other possible file extension types that I should 
be looking at?

Thanks,

Don.

_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Don Taylor
Terry Carroll
Don Taylor
Terry Carroll
Kent Johnson

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved