Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeze failed after adding the --debug flag on Windows. #72

Closed
JeziL opened this issue Jan 24, 2019 · 6 comments · Fixed by #77
Closed

Freeze failed after adding the --debug flag on Windows. #72

JeziL opened this issue Jan 24, 2019 · 6 comments · Fixed by #77

Comments

@JeziL
Copy link

JeziL commented Jan 24, 2019

I have generated an installer with Appveyor CI system. But when I run the program it shows the Failed to execute script main error, so according to the troubleshooting instruction, I added the --debug flag:

fbs freeze --debug

Then the freeze command failed with a FileNotFoundError:

Traceback (most recent call last):
  File "C:\Python36-x64\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
  File "c:\python36-x64\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\python36-x64\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\python36-x64\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\python36-x64\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 17, in <module>
  File "c:\python36-x64\lib\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
    self.__postinit__()
  File "c:\python36-x64\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\python36-x64\lib\site-packages\PyInstaller\building\build_main.py", line 595, in assemble
    for name, path, typecode in compile_py_files(new_toc, CONF['workpath']):
  File "c:\python36-x64\lib\site-packages\PyInstaller\utils\misc.py", line 150, in compile_py_files
    with open(obj_fnm, 'rb') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '-'
Traceback (most recent call last):
  File "C:\Python36-x64\Scripts\fbs-script.py", line 11, in <module>
    load_entry_point('fbs==0.6.6', 'console_scripts', 'fbs')()
  File "c:\python36-x64\lib\site-packages\fbs\__main__.py", line 17, in _main
    fbs.cmdline.main()
  File "c:\python36-x64\lib\site-packages\fbs\cmdline.py", line 32, in main
    fn(*args)
  File "c:\python36-x64\lib\site-packages\fbs\builtin_commands\__init__.py", line 113, in freeze
    freeze_windows(debug=debug)
  File "c:\python36-x64\lib\site-packages\fbs\freeze\windows.py", line 18, in freeze_windows
    run_pyinstaller(args, debug)
  File "c:\python36-x64\lib\site-packages\fbs\freeze\__init__.py", line 43, in run_pyinstaller
    run(args, check=True)
  File "c:\python36-x64\lib\subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pyinstaller', '--name', 'RadUI', '--noupx', '--log-level', 'DEBUG', '--noconfirm', '--icon', 'C:\\projects\\radui\\src\\main\\icons\\Icon.ico', '--distpath', 'C:\\projects\\radui\\target', '--specpath', 'C:\\projects\\radui\\target\\PyInstaller', '--workpath', 'C:\\projects\\radui\\target\\PyInstaller', 'C:\\projects\\radui\\src\\main\\python\\main.py', '--debug', '--runtime-hook', 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\tmpug9nomyf\\fbs_pyinstaller_hook.py']' returned non-zero exit status 1.

Any idea why adding a flag can cause a different behavior?

@mherrmann
Copy link
Owner

I don't know, sorry. Does the problem only occur when you build on AppVeyor? Does it also occur for a completely "fresh" project?

fbs startproject
fbs freeze --debug

@JeziL
Copy link
Author

JeziL commented Jan 25, 2019

Thanks for the reply.

It occurs on my local computer, too. But for a fresh project, the error doesn't appear.

I think it has something to do with this --debug flag. Because I commented out line 39-40 here which prevent fbs from passing the --debug flag to PyInstaller. And it worked... I'm not familiar with PyInstaller. Is the --debug flag necessary for it?

@mherrmann
Copy link
Owner

I see. I have a feeling it is a bug in PyInstaller then.

The --debug flag tells PyInstaller to output more information when your frozen application is starting up. It kind of is required for fbs freeze --debug to make sense.

I would suggest asking about this behavior(/bug?) on PyInstaller's issue tracker. And maybe temporarily deleting lines 39-40 will let you debug your Failed to execute script main problems, then continue development?

@JeziL
Copy link
Author

JeziL commented Jan 27, 2019

Thanks. I deleted L39~40 and the frozen app still gave me the debug info.

It turns out that my Failed to execute script main error is caused by a PyInstaller bug (pyinstaller/pyinstaller#3982), too.

@JeziL JeziL closed this as completed Jan 27, 2019
@mherrmann
Copy link
Owner

Great! Thank you for letting me know - and for sharing your solution with @BorisDess in #74 too.

@Aperion
Copy link

Aperion commented Aug 1, 2019

I ran into this same issue, I downgraded to 3.6 and it went away. it also went away in 3.7 if I called PyInstaller.__main__.run(...) instead of using subprocess.

I ran into in 3.6 as well. it is the same fix, I'll see if I can get around coming up with a fork for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants