This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: -O breaks bundlebuilder --standalone
Type: Stage:
Components: macOS Versions: Python 2.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jvr Nosy List: jvr, ronaldoussoren, swerdlow
Priority: normal Keywords:

Created on 2003-11-13 23:00 by swerdlow, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg18995 - (view) Author: Bob Swerdlow (swerdlow) Date: 2003-11-13 23:00
Just van Rossum suggested I file this bug report:

When building with
    python -O -v --standalone --
package=encodings --package=_strpTime --packag
e=urllib2 build
I got these errors:
    'import site' failed; use -v for traceback
    Traceback(most recent call last):
file "./build/", 
line 6, in ?
        import copy
    ImportError: No module named copy

The "import copy" problem is simply cascaded off 
the "import site" problem. A site.pyo file was generated 
in the /build/, but 
it is obviously not being used properly.

To get it to work, I first built the application without 
the -O flag, saved the site.pyc file, then built it again 
with the -O flag and restored the site.pyc file.  With this 
hack, the application works fine.

Just responded:
I think you need to hack the bootstrap script by adding
    sys.argv.insert(1, "-O")
after this line:
    sys.argv.insert(1, mainprogram)

He also asked if -O was really worth the trouble, but 
that should be the programmer's decision, not the 
framework's.  bundlebuilder should support --standalone 
with -O.
msg78816 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-01-02 15:25
Fixed in r68163
Date User Action Args
2022-04-11 14:56:01adminsetgithub: 39545
2009-01-02 15:25:59ronaldoussorensetstatus: open -> closed
nosy: + ronaldoussoren
resolution: fixed
messages: + msg78816
2003-11-13 23:00:51swerdlowcreate