简体   繁体   中英

unable to include module in py2exe setup script (python3)

I'm trying to create an exe of a script I wrote, but i'm unable do include a package i need, the package is hurry.filesize, but where ever I run setup.py I get an error "ImportError: hurry" , It's escaping the dot and not reading the whole word, I've tried 'hurry\\.filesize' and many other combinations and it doesn't read the whole name.

Here is the setup script:

from distutils.core import setup
import py2exe, sys, os

sys.argv.append('py2exe')

data_files = []
for files in os.listdir('./img/'):
    f1 = './img/' + files
    if os.path.isfile(f1):  # skip directories
        f2 = 'img', [f1]
        data_files.append(f2)

setup(windows=[{'script': 'Artifactory_Spider.py', 'icon_resources': [(0, './img\\tachk.ico')]}],
      data_files=data_files,
      options={'py2exe': {'includes': ['patoolib', 'hurry.filesize'], 'bundle_files': 2, 'compressed': True, 'dist_dir': './Artifactory Spider'}},
      zipfile=None,)

This is a bit late in coming, but I just hit exactly the same problem.

The solution which - worked for me - is to create an empty __init__.py file in the hurry folder.

eg C:\\Python34\\Lib\\site-packages\\hurry\\__init__.py

Then cxfreeze will include the hurry.filesize module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM