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

Discussion in 'Python' started by Stef Mientki, Jun 7, 2009.

  1. Stef Mientki

    Stef Mientki Guest

    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.

    Is this normal,
    or am I doing something completely wrong ?

    thanks,
    Stef Mientki
    Stef Mientki, Jun 7, 2009
    #1
    1. Advertising

  2. On Sun, 07 Jun 2009 18:16:26 +0200, 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.


    Sounds like a py2exe problem, not a Python problem. Perhaps you should
    ask them?

    https://lists.sourceforge.net/lists/listinfo/py2exe-users


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


    Define "doesn't run".

    You mean the exe file doesn't launch at all? Does Windows display an
    error message?

    Or perhaps it launches, then immediately exists? Launches, then crashes?
    Does it show up in the process list at all? Or something else?



    --
    Steven
    Steven D'Aprano, Jun 7, 2009
    #2
    1. Advertising

  3. 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
    Diez B. Roggisch, Jun 8, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Dyer
    Replies:
    5
    Views:
    638
  2. Noah
    Replies:
    5
    Views:
    767
  3. Alexander Hoffmann

    *.pyc files without using absolute path

    Alexander Hoffmann, Sep 8, 2004, in forum: Python
    Replies:
    1
    Views:
    390
    Thomas Heller
    Sep 8, 2004
  4. David Siroky

    pyo contains absolute paths

    David Siroky, Jul 9, 2005, in forum: Python
    Replies:
    6
    Views:
    667
    Daniel Dittmar
    Jul 11, 2005
  5. Ohad Lutzky

    Paths, gentleman, paths

    Ohad Lutzky, Nov 6, 2006, in forum: Ruby
    Replies:
    2
    Views:
    184
    David Vallner
    Nov 7, 2006
Loading...

Share This Page