takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
883 stars 119 forks source link

ImportError: Could not find '' #205

Closed mirrorcult closed 3 years ago

mirrorcult commented 3 years ago
$ pynsist win_installer.cfg
Unpacking Python...
Copying packages into build directory...
Traceback (most recent call last):
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\(myname)\AppData\Local\Programs\Python\Python36-32\Scripts\pynsist.exe\__main__.py", line 7, in <module>
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\site-packages\nsist\__init__.py", line 520, in main
    ec = InstallerBuilder(**args).run(makensis=(not options.no_makensis))
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\site-packages\nsist\__init__.py", line 473, in run
    self.prepare_packages()
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\site-packages\nsist\__init__.py", line 351, in prepare_packages
    py_version=self.py_version, exclude=self.exclude)
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\site-packages\nsist\copymodules.py", line 165, in copy_modules
    mc.copy(modname, target, exclude)
  File "c:\users\(myname)\appdata\local\programs\python\python36-32\lib\site-packages\nsist\copymodules.py", line 115, in copy
    raise ImportError('Could not find %r' % modname)
ImportError: Could not find ''

Config file:

[Application]
name=TF2 Discord
version=3.1.0
entry_point=..\src\main:tf2_discord
console=false
license_file=..\LICENSE

[Python]
version=3.6.5
format=bundled

[Include]
packages = pypresence
    valve
    psutil

files = ..\LICENSE
    ..\README.md

Relevant file-structure: image

I guessed that this was related to the packages and/or file includes due to the nature of the error. Or that it was an issue with whitespace? But removing the [Include] section entirely leaves me with an identical error, so I have absolutely no idea.

takluyver commented 3 years ago

I think this line is the problem:

entry_point=..\src\main:tf2_discord

The first part of that expects an importable module name, not a path. Something like mymod:main, where you can do from mymod import main.

The error message could be clearer, though.

mirrorcult commented 3 years ago

Ahh, that makes sense. Yeah, the error message could be a little more helpful.