Re: [SLUG] pysol magic number

From: Paul M Foster (paulf@quillandmouse.com)
Date: Wed Jan 07 2004 - 18:52:45 EST


On Tue, Jan 06, 2004 at 09:58:16PM -0500, Bob Stia wrote:

> On Monday 05 January 2004 06:45 pm, Paul M Foster wrote:
> > On Mon, Jan 05, 2004 at 12:54:54AM -0500, Bob Stia wrote:
> >
> > <snip>
> >
> > > OK Daniel, my python is 2.2.2-92 The pysol is 4.81-191
> > > I also have a later version of pysol (4.82-28) which I downloaded
> > > from the pysol site but it will not install because it says I need
> > > python 2.2.3 which I cannot seem to find. It is available but only
> > > as a i686. Don't know if that will work. If you don't have any
> > > other ideas I will have to go searching.
> >
> > Just a comment, here. You don't actually need the .pyc file to run
> > something. Python will compile code on the fly. In fact, Python can
> > be made to recompile source code into the bytecode contained in .pyc
> > files. However, running a straight .py file might not work either, if
> > the library calls have changed between the version you're running and
> > the version in which the source code is written.
> >
> Hmmmmm....OK Paul. Another bit of knowledge to be tucked away for when I
> don't know. Seriously, thanks for replying and I am sure many more
> ambitious people appreciate that bit of knowledge. Afraid that doesn't
> help me much though. Don't know how I can tell the differences for the
> library calls. Don't really want to learn Python at this stage of the
> game.

I assumed knowledge you probably don't have. Python has been changing
its feature set for the last little while (it's a young language). In
practical terms, that could mean something like this: Say before you
could write p++ to increment p, but now you have to write p = p + p.
(Contrived example.) If your running code contains stuff like this, but
you're trying to run it under an older python interpreter, it might
choke. That's kinda what I meant by "library calls". I didn't express it
well at all, though.

As for byte-coded versus human-readable python, .pyc files are an
intermediate form of code (not human-readable) that python interprets
more quickly than regular human-readable .py files. You can remove a
.pyc file and force python to recompile the .py file into a new .pyc
file (with a special command), but that's not really what you want to
do. The point is that, a .pyc file is normally not needed for a python
program to run; it just speeds things up. You can often eliminate the
.pyc file and just run the .py file. This works fine if your application
consists of a single .pyc file, but may not if your application is a mix
of .pyc and .py files.

Anyway, I've geeked all over you now, so I'll just shut up. ;-}

Paul
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:14:55 EDT