Re: [Tutor] Version of a .pyc file

2006-04-21 Thread Terry Carroll
On Fri, 21 Apr 2006, Don Taylor wrote:

> That did it, and it was a .pyd file that was giving me problems, thanks 
> once again Terry.

Great to hear!

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-21 Thread Don Taylor
Terry Carroll wrote:

> I've had some pretty good luck using Process Explorer, freeware from 

That did it, and it was a .pyd file that was giving me problems, thanks 
once again Terry.

Process Explorer is _very_ nice and will certainly stay on my machine.


Don.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-20 Thread Don Taylor
Terry Carroll wrote:
> On Wed, 19 Apr 2006, Don Taylor wrote:
> 
> 
>>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.
> 
> 
> Don --
> I've had some pretty good luck using Process Explorer, freeware from 
> SysInternals, to locate processes that are using a particular file or DLL 
> and shutting them down.  I don't know how well that will work for you, 
> because it might just ID Eclipse as the culprit, with no further 
> information, and you already know that.  But its tree view may give you 
> more info.
> 
> It's a great utility in any event.
> 
> http://www.sysinternals.com/Utilities/ProcessExplorer.html
> 
> I'm gathering from the reference to DLLs that you're running under 
> Windows.  If I misunderstand, ignore this; Process Explorer is for Windows.
> 

Terry:

Yes I am using Windows so I will take a look at Process Explorer.

Thanks,

Don.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-20 Thread Don Taylor
Kent Johnson wrote:
> Don Taylor wrote:
> 
>>Finally, are there any other possible file extension types that I should 
>>be looking at?
> 
> 
> .pyo is like a .pyc but compiled with optimizations on.
> 
Hi Kent:

No, I really meant a .pyd file which is Python's name for a .dll which 
conforms to the Python requirements to be a Python extension written in 
C/C++.

But, I should check my .pyo files as well so thanks for this.

Don.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-20 Thread Terry Carroll
On Wed, 19 Apr 2006, Don Taylor wrote:

> 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.

Don --
I've had some pretty good luck using Process Explorer, freeware from 
SysInternals, to locate processes that are using a particular file or DLL 
and shutting them down.  I don't know how well that will work for you, 
because it might just ID Eclipse as the culprit, with no further 
information, and you already know that.  But its tree view may give you 
more info.

It's a great utility in any event.

http://www.sysinternals.com/Utilities/ProcessExplorer.html

I'm gathering from the reference to DLLs that you're running under 
Windows.  If I misunderstand, ignore this; Process Explorer is for Windows.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-19 Thread Kent Johnson
Don Taylor wrote:
> Finally, are there any other possible file extension types that I should 
> be looking at?

.pyo is like a .pyc but compiled with optimizations on.

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-19 Thread Don Taylor
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@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Version of a .pyc file

2006-04-18 Thread Terry Carroll
On Tue, 18 Apr 2006, Don Taylor 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

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Version of a .pyc file

2006-04-18 Thread Don Taylor
I want like to write a script to scan all of the .pyc on my pythonpath 
to find out if they were built with Python 2.3 or 2.4.

How can I tell if a .pyc file was built with 2.3 or 2.4?

Thanks,

Don.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor