spacebridge icon indicating copy to clipboard operation
spacebridge copied to clipboard

build fails on python (3.8?) 3.9 due to known bug in pyinstaller

Open scottw-finao opened this issue 1 year ago • 3 comments

When the build code gets down to the PYZ step, it fails saying 'TypeError: an integer is required (got type bytes)'

3498 INFO: checking PYZ
3501 INFO: Building PYZ because out00-PYZ.toc is non existent
3504 INFO: Building PYZ (ZlibArchive) /home/swood/src/spacebridge/build/spacebridge/out00-PYZ.pyz
Traceback (most recent call last):
  File "/home/swood/src/spacebridge/ve/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/__main__.py", line 92, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 791, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 737, in build
    exec(text, spec_namespace)
  File "<string>", line 17, in <module>
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/api.py", line 98, in __init__
    self.__postinit__()
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
    self.assemble()
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/api.py", line 128, in assemble
    self.code_dict = {
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/utils.py", line 624, in strip_paths_in_code
    consts = tuple(
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/utils.py", line 625, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
  File "/home/swood/src/spacebridge/ve/lib/python3.9/site-packages/PyInstaller/building/utils.py", line 632, in strip_paths_in_code
    return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
TypeError: an integer is required (got type bytes)

Some searching on this error discovered it was a known problem on some platforms in older versions of pyinstaller:

https://github.com/pyinstaller/pyinstaller/issues/4265

I tried putting in the latest version of pyinstaller in the requirements.txt but then started getting an error about sbgui not found. I am not as familiar with python but will look more at it later to see what else I can figure out.

scottw-finao avatar Sep 29 '23 20:09 scottw-finao

it looks like the support for python 3.8 and 3.9 was starting to be implimented in pyinstaller 4.1. modifying the requirements.txt to v 4.1 for pyinstaller, I then get errors on sbgui not being found. Trying to manually run pyi-makespec and/or pyinstaller with --hidden-import on sbgui then gives me errors on tkinter not found.

I'm not as familiar with python coding and packaging having a mostly perl and php background. Any help to get the spacebridge client compiled on newer python would be appreciated. In the meantime, I'll see if I can install python 3.7 somewhere to try building it for arm there.

scottw-finao avatar Sep 29 '23 21:09 scottw-finao

Trying to install versions of python 3.7 from source, I'm finding yet another bug in the build for the test_faulthandler and/or Modules/faulthandler.c code in v3.7 (multiple places reported)

Can someone please update this code to work with python newer than 3.7?

scottw-finao avatar Oct 02 '23 19:10 scottw-finao

Trying to compile under current libs in python3.9

sudo pip install easy

Things I'm finding so far:

Modify line 42 in SpaceBridge/spacebridge.py from: import sbgui to: import SpaceBridge.sbgui

Modify line 34 in SpaceBridge/sbgui.py from: from Tkinter import * to: from tkinter import *

On debian (and possibly other system) you may need to create symlinks in /usr/share/tcltk:

e.g.

sudo su
cd /usr/share/tcltk
ln -s tcl8.6 tcl8
ln -s tk8.6 tk8

Still running into the tkinter errors mentioned in the top of sbgui -- I'll delve further into those to see if i can find fixes if I can. Any assistance would be appreciated. Python 2.7 has been out of support for a while now - it would be nice to still be able to use the hologram hardware on newer machines/software.

scottw-finao avatar Oct 03 '23 15:10 scottw-finao