fbs icon indicating copy to clipboard operation
fbs copied to clipboard

FileNotFoundError: [Errno 2] No such file or directory: '-'

Open alidaoudi1 opened this issue 6 years ago • 7 comments

I'm using windows and running fbs from the command prompt. I have an issue when freezing the app, this is what I get with the verbose mode :

150770 INFO: Found binding redirects:
[]
Traceback (most recent call last):
  File "c:\users\and15\venv\scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
  File "c:\users\and15\venv\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\and15\venv\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\and15\venv\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:\users\and15\venv\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 17, in <module>
  File "c:\users\and15\venv\lib\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
    self.__postinit__()
  File "c:\users\and15\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\users\and15\venv\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:\users\and15\venv\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:\Users\and15\venv\Scripts\fbs-script.py", line 11, in <module>
    load_entry_point('fbs==0.6.6', 'console_scripts', 'fbs')()
  File "c:\users\and15\venv\lib\site-packages\fbs\__main__.py", line 17, in _main
    fbs.cmdline.main()
  File "c:\users\and15\venv\lib\site-packages\fbs\cmdline.py", line 32, in main
    fn(*args)
  File "c:\users\and15\venv\lib\site-packages\fbs\builtin_commands\__init__.py", line 113, in freeze
    freeze_windows(debug=debug)
  File "c:\users\and15\venv\lib\site-packages\fbs\freeze\windows.py", line 18, in freeze_windows
    run_pyinstaller(args, debug)
  File "c:\users\and15\venv\lib\site-packages\fbs\freeze\__init__.py", line 43, in run_pyinstaller
    run(args, check=True)
  File "C:\Users\and15\AppData\Local\Continuum\anaconda3\lib\subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pyinstaller', '--name', 'Gui', '--noupx', '--log-level', 'DEBUG', '--noconfirm', '--icon', 'C:\\Users\\and15\\ShoeCalc\\ShoeGUI\\Integration\\src\\main\\icons\\Icon.ico', '--distpath', 'C:\\Users\\and15\\ShoeCalc\\ShoeGUI\\Integration\\target', '--specpath', 'C:\\Users\\and15\\ShoeCalc\\ShoeGUI\\Integration\\target\\PyInstaller', '--workpath', 'C:\\Users\\and15\\ShoeCalc\\ShoeGUI\\Integration\\target\\PyInstaller', 'C:\\Users\\and15\\ShoeCalc\\ShoeGUI\\Integration\\src\\main\\python\\main.py', '--debug', '--runtime-hook', 'C:\\Users\\and15\\AppData\\Local\\Temp\\tmp891qu3fs\\fbs_pyinstaller_hook.py']' returned non-zero exit status 1.```

Thanks in advance. 

alidaoudi1 avatar Jan 31 '19 20:01 alidaoudi1

I just released fbs 0.6.7. Does the problem still occur for you with this version?

mherrmann avatar Feb 07 '19 14:02 mherrmann

I presume it doesn't - closing this issue. Feel free to re-open @alidaoudi1.

mherrmann avatar Feb 12 '19 11:02 mherrmann

If your virtualenv install zope package, and then running "fbs freeze --debug", the result will output:

  File "/Users/bb/.virtualenvs/vv/bin/pyinstaller", line 10, in <module>
    sys.exit(run())
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "/Users/bb/Public/japan_shenyuan/target/PyInstaller/vv.spec", line 17, in <module>
    noarchive=True)
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
    self.__postinit__()
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 597, in assemble
    for name, path, typecode in compile_py_files(new_toc, CONF['workpath']):
  File "/Users/bb/.virtualenvs/vv/lib/python3.6/site-packages/PyInstaller/utils/misc.py", line 157, in compile_py_files
    with open(obj_fnm, 'rb') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '-'

Debug PyInstaller source code(filename: PyInstaller/utils.misc.py linenumber: 150), exist a invalid list element: ('zope.pyc', '-', 'PYMODULE')

unlessbamboo avatar Aug 21 '19 02:08 unlessbamboo

@unlessbamboo I cannot reproduce this. Here's what I tried on macOS (like you) with Python 3.6.7:

python3 -m venv venv
source venv/bin/activate
pip install fbs PyQt5==5.9.2 zope
fbs startproject
fbs freeze --debug

mherrmann avatar Aug 21 '19 08:08 mherrmann

@unlessbamboo I cannot reproduce this. Here's what I tried on macOS (like you) with Python 3.6.7:

python3 -m venv venv
source venv/bin/activate
pip install fbs PyQt5==5.9.2 zope
fbs startproject
fbs freeze --debug

Thanks, My PyQt5's VERSION is 5.13.0. I had resolved this problem through modify PyInstaller source code.

filename: PyInstaller/utils/misc.py line number: 150:

        needs_compile = mtime(src_fnm) > mtime(obj_fnm)
        if not needs_compile:
            if not os.path.exists(obj_fnm):
                continue
            with open(obj_fnm, 'rb') as fh:
                needs_compile = fh.read()[:4] != BYTECODE_MAGIC

unlessbamboo avatar Aug 21 '19 09:08 unlessbamboo

Okay, so it's a version incompatibility with PyQt5 5.13.0.

mherrmann avatar Aug 21 '19 09:08 mherrmann

I had the same problem : fbs was failing because PyInstaller was failing due to a '-' file not found. I added logging to PyInstaller\utils\misc.py:123 with

print("nm=%r, fnm=%r, typ=%r" % (nm, fnm, typ))

It showed me it was trying to compile a package whose folder had no __init__.py in. Just adding an empty __init__.py file solved the issue.

Lenormju avatar Sep 12 '19 13:09 Lenormju