pyc-files contains absolute paths, is this a bug ?

Diez B. Roggisch deets at nospam.web.de
Mon Jun 8 18:15:07 CEST 2009


Stef Mientki wrote:

> hello,
> 
> AFAIK I read that pyc files can be transferred to other systems.
> I finally got a windows executable working through py2exe,
> but still have some troubles, moving the directory around.
> 
> I use Python 2.5.2.
> I use py2exe to make a distro
> I can unpack the distro, on a clean computer, anywhere where I like, and
> it runs fine.
> 
> Now when I've run it once,
> I move the subdirectory to another location,
> at it doesn't run.
> 
> Looking with a hex editor into some pyc-files,
> I see absolute paths to the old directory.

It is normal, because they refer to the location of the source-files, which
are needed for stacktraces (or at least something like that)

But execution itself is independent from this.
 
> Is this normal,
> or am I doing something completely wrong ?

Dunno anything about py2exe, but it sure sounds a bit awkward what you do -
changing locations of files after installation is calling for trouble in
lots of software. But I might not have understood what you actually did - 
and "doesn't" run isn't helping much in that regard.....

Diez



More information about the Python-list mailing list