py2exe and CD-ROM ISO Level 1

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Werner Merkl

    #1

    py2exe and CD-ROM ISO Level 1

    Hi,


    [still looking for a solution]

    we have written a Python EXE program, which should run via AUTORUN.INF
    from a CD/DVD (Windows of course).

    For this CD/DVD we us a imaging tool from Microsoft, which seam to
    generate a pure ISO 9660 level 1 image.

    This means:
    - Only upper case letters A-Z and numbers 0-9
    - 8.3 file names

    For Python 2.2 and py2exe 0.4.1 this worked fine. Today, it does not.

    So:
    - Is there an option to generate a py2exe program with PYTHONCASE set?
    - Or do I need a wrapper? (My own C program, setting the environment
    and then starting the Python EXE program.)
    - Is there a tricky way to start up with code like
    "import OS as os"?
    - May I use my own case insensitive importer?
    - Or do I need to recompile Python?


    Thanks in advance
    Werner
  • Thomas Heller

    #2
    Re: py2exe and CD-ROM ISO Level 1

    Werner Merkl <werner_DOT_mer kl_@_fujitsu_DA SH_siemens.com> writes:
    [color=blue]
    > Hi,
    >
    >
    > [still looking for a solution]
    >
    > we have written a Python EXE program, which should run via AUTORUN.INF
    > from a CD/DVD (Windows of course).
    >
    > For this CD/DVD we us a imaging tool from Microsoft, which seam to
    > generate a pure ISO 9660 level 1 image.
    >
    > This means:
    > - Only upper case letters A-Z and numbers 0-9
    > - 8.3 file names
    >
    > For Python 2.2 and py2exe 0.4.1 this worked fine. Today, it does not.
    >
    > So:
    > - Is there an option to generate a py2exe program with PYTHONCASE set?
    > - Or do I need a wrapper? (My own C program, setting the environment
    > and then starting the Python EXE program.)
    > - Is there a tricky way to start up with code like
    > "import OS as os"?
    > - May I use my own case insensitive importer?
    > - Or do I need to recompile Python?[/color]

    What errors exactly do you get?

    Although I have posted before that this wouldn't work, currently I
    believe that it *should* work.
    I tried the 'simple' sample in the py2exe distro, which contains a
    trvivial command line program, plus a simple wxPython program, wrote
    them to an ISO level 1 CD, and it worked.

    1. The python modules are imported from the zip file, as long as this
    has an 8.3 name, all should be fine.

    2. Extension modules are loaded with imp.load_dynami c (custom loaders
    are created for them, in py2exe\build_ex e.py, the create_loader method).
    As far as I can see, imp.load_dynami c(module_name, file_name) should
    work independent of the case or spelling of 'file_name'. If the
    extensions you need have filenames with more than 8 characters, you
    could probably subclass the build_exe command.

    Thomas

    Comment

    • Werner Merkl

      #3
      Re: py2exe and CD-ROM ISO Level 1

      Thomas Heller wrote:
      [color=blue]
      > Werner Merkl <werner_DOT_mer kl_@_fujitsu_DA SH_siemens.com> writes:
      >
      >[color=green]
      >>Hi,
      >>
      >>
      >>[still looking for a solution]
      >>
      >>we have written a Python EXE program, which should run via AUTORUN.INF
      >>from a CD/DVD (Windows of course).
      >>
      >>For this CD/DVD we us a imaging tool from Microsoft, which seam to
      >>generate a pure ISO 9660 level 1 image.
      >>
      >>This means:
      >> - Only upper case letters A-Z and numbers 0-9
      >> - 8.3 file names
      >>
      >>For Python 2.2 and py2exe 0.4.1 this worked fine. Today, it does not.
      >>
      >>So:
      >> - Is there an option to generate a py2exe program with PYTHONCASE set?
      >> - Or do I need a wrapper? (My own C program, setting the environment
      >> and then starting the Python EXE program.)
      >> - Is there a tricky way to start up with code like
      >> "import OS as os"?
      >> - May I use my own case insensitive importer?
      >> - Or do I need to recompile Python?[/color]
      >
      >
      > What errors exactly do you get?
      >
      > Although I have posted before that this wouldn't work, currently I
      > believe that it *should* work.
      > I tried the 'simple' sample in the py2exe distro, which contains a
      > trvivial command line program, plus a simple wxPython program, wrote
      > them to an ISO level 1 CD, and it worked.
      >
      > 1. The python modules are imported from the zip file, as long as this
      > has an 8.3 name, all should be fine.
      >
      > 2. Extension modules are loaded with imp.load_dynami c (custom loaders
      > are created for them, in py2exe\build_ex e.py, the create_loader method).
      > As far as I can see, imp.load_dynami c(module_name, file_name) should
      > work independent of the case or spelling of 'file_name'. If the
      > extensions you need have filenames with more than 8 characters, you
      > could probably subclass the build_exe command.
      >
      > Thomas[/color]

      Hi,

      I recompiled my application as a console program and got following error
      message:

      -----------------------------------------------------------------------
      Microsoft Windows XP [Version 5.1.2600]
      (C) Copyright 1985-2001 Microsoft Corp.

      C:\>e:\AUTORUN. EXE
      Traceback (most recent call last):
      File "D:\PROGS\Pytho n23\lib\site-packages\py2exe \boot_common.py ",
      line 69, in ?
      import linecache
      zipimport.ZipIm portError: can't decompress data; zlib not available
      Traceback (most recent call last):
      File "AutoRun.py ", line 54, in ?
      zipimport.ZipIm portError: can't decompress data; zlib not available
      -----------------------------------------------------------------------

      so I removed "compressed ": 1, from setup.py and it WORKS!!!
      This seems to be a bug in py2exe ????

      Thanks a lot
      Werner

      -----------------------------------------------------------------------
      ---------------------- part of setup.py ------------------------------
      [...]
      setup(
      options = {"py2exe": {# create a compressed zip archive
      "compressed ": 1,
      "optimize": 2,
      "packages": ["encodings"],
      "excludes": excludes}},
      # The lib directory contains everything except the executables and
      # the python dll.
      # Can include a subdirectory name.
      zipfile = "lib/shared.zip",
      data_files = [('bin',glob.glo b("bin/*")),
      ('.',['AUTORUN.INF',' ReadMe.txt'])],

      ## windows = [AutoRun],
      console = [AutoRun],
      )

      Comment

      • Thomas Heller

        #4
        Re: py2exe and CD-ROM ISO Level 1

        Werner Merkl <werner_DOT_mer kl_@_fujitsu_DA SH_siemens.com> writes:
        [color=blue]
        > Hi,
        >
        > I recompiled my application as a console program and got following
        > error message:
        >
        > -----------------------------------------------------------------------
        > Microsoft Windows XP [Version 5.1.2600]
        > (C) Copyright 1985-2001 Microsoft Corp.
        >
        > C:\>e:\AUTORUN. EXE
        > Traceback (most recent call last):
        > File "D:\PROGS\Pytho n23\lib\site-packages\py2exe \boot_common.py ",
        > line 69, in ?
        > import linecache
        > zipimport.ZipIm portError: can't decompress data; zlib not available
        > Traceback (most recent call last):
        > File "AutoRun.py ", line 54, in ?
        > zipimport.ZipIm portError: can't decompress data; zlib not available
        > -----------------------------------------------------------------------
        >
        > so I removed "compressed ": 1, from setup.py and it WORKS!!![/color]

        Great!
        [color=blue]
        > This seems to be a bug in py2exe ????[/color]

        The zlib module is the only one that is imported with the standard
        mechanism, since it is imported when a zipfile is added to sys.path.
        So, when it's filename has the wrong case the import will fail, and the
        only solution would be to set PYTHONCASEOK=1 before. Unfortunately,
        this cannot be done somewhere in your Pythoncode, because it's too late
        then. So, if you insist on 'compressed': 1 (but why would you?) the
        only solution that I see is to add
        _putenv("PYTHON CASEOK=1");
        to the source file start.c, somewhere in the init_with_insta nce
        function, near line 135, and rebuild py2exe.

        Thomas

        Comment

        • Werner Merkl

          #5
          Re: py2exe and CD-ROM ISO Level 1

          Thomas Heller wrote:
          [color=blue]
          > Werner Merkl <werner_DOT_mer kl_@_fujitsu_DA SH_siemens.com> writes:
          >
          >[color=green]
          >>Hi,
          >>
          >>I recompiled my application as a console program and got following
          >>error message:
          >>
          >>-----------------------------------------------------------------------
          >>Microsoft Windows XP [Version 5.1.2600]
          >>(C) Copyright 1985-2001 Microsoft Corp.
          >>
          >>C:\>e:\AUTORU N.EXE
          >>Traceback (most recent call last):
          >> File "D:\PROGS\Pytho n23\lib\site-packages\py2exe \boot_common.py ",
          >> line 69, in ?
          >> import linecache
          >>zipimport.Zip ImportError: can't decompress data; zlib not available
          >>Traceback (most recent call last):
          >> File "AutoRun.py ", line 54, in ?
          >>zipimport.Zip ImportError: can't decompress data; zlib not available
          >>-----------------------------------------------------------------------
          >>
          >>so I removed "compressed ": 1, from setup.py and it WORKS!!![/color]
          >
          >
          > Great!
          >
          >[color=green]
          >>This seems to be a bug in py2exe ????[/color]
          >
          >
          > The zlib module is the only one that is imported with the standard
          > mechanism, since it is imported when a zipfile is added to sys.path.
          > So, when it's filename has the wrong case the import will fail, and the
          > only solution would be to set PYTHONCASEOK=1 before. Unfortunately,
          > this cannot be done somewhere in your Pythoncode, because it's too late
          > then. So, if you insist on 'compressed': 1 (but why would you?) the
          > only solution that I see is to add
          > _putenv("PYTHON CASEOK=1");
          > to the source file start.c, somewhere in the init_with_insta nce
          > function, near line 135, and rebuild py2exe.
          >
          > Thomas[/color]
          Thank you very much for you explanation. I think, I will not use
          compressed in future (normally there is enough space on a DVD or
          even on a CD ;-).


          regards
          Werner

          Comment

          Working...