Menu

#142 using modules that use open on data files

open
nobody
None
5
2015-12-28
2015-12-18
Axle
No

py2exe is throwing erros due to open() not being able to work on files in a zip folder.

If i do a simple script
that includes

import past
(part of the future module) it will use a subpackage in lib2to3 called pgen2 which attempts to open a data file in lib2to3.

Is there a way to get this to work?

Cxfreeze works aroud this by you to unzip a module from library.zip and place it next to it which will get read instead, this works 100% fine.

Kind Regards

Discussion

  • Mark Hammond

    Mark Hammond - 2015-12-19

    You can either change your code to use on of the zip libraries to open the file, or consider using http://www.py2exe.org/index.cgi/data_files

     
  • Axle

    Axle - 2015-12-21

    What are you suggesting exactly with the data files? I tried sucking them into a folder of the same name sitting next to the library.zip, however i still got my error. Modifying the source is a not going to really cut it in my case unfortunatley...

     
  • Mark Hammond

    Mark Hammond - 2015-12-21

    data_files should let you copy files into the created "dist", thus allowing them to be opened as regular files.

     
  • Axle

    Axle - 2015-12-28

    Without modification to anything? After using data files i have my library folder in a zip, then i have my module folder with my data files inside the "dist". This fails for the same reason, the module doesn't know where to find the data files.

     

Log in to post a comment.

MongoDB Logo MongoDB