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

Uncaught "ValueError: Invalid component name '-b'!" on Start-Up on Ubuntu 20.10 #1585

Closed
ghost opened this issue May 11, 2021 · 10 comments
Closed
Labels
App Crash Something is causing the app to crash Linux Issue only applies to Linux

Comments

@ghost
Copy link

ghost commented May 11, 2021

BEE2 version: 4.39.2

Description of the bug: The application crashes on start-up with the following error-message:

[I] utils.setup_localisations(): Language: 'en_GB'
[I] BEE2_launch.<module>(): Arguments: ['/home/userzeroex/beemod/BEE2.4/dist/64bit/BEE2/BEE2', '-B', '-S', '-E', '-s', '-c', 'from multiprocessing.resource_tracker import main;main(9)']
[I] BEE2_launch.<module>(): Running "-b", version 4.39.2:
[E] logger.except_handler(): Uncaught Exception:
Traceback (most recent call last):
  File "BEE2_launch.pyw", line 57, in <module>
ValueError: Invalid component name "-b"!

Steps to reproduce:

  1. Follow the build-instructions
  2. Start BEEMod

Additional information:

  • OS: Ubuntu 20.10 Groovy Gorilla on x86_64
  • Python: CPython v. 3.8.6-final
  • Generated log-file
@ghost ghost added the App Crash Something is causing the app to crash label May 11, 2021
@LautaroL20 LautaroL20 added the Linux Issue only applies to Linux label May 11, 2021
@TeamSpen210
Copy link
Member

Did you provide those startup parameters? They're definitely not something it expects. You could try running just with a parameter of BEE2, if those are getting injected afterwards.

@ghost
Copy link
Author

ghost commented May 11, 2021 via email

@ghost
Copy link
Author

ghost commented May 12, 2021

I decided to try to run src/BEE2_launch.pyw directly using my system's Python-installation (CPython 3.8.6) instead of packaging the app with PyInstaller. I still encountered a fatal error (log-file), but the app at least started and prompted me to enter Portal 2's game-directory.

From that log-file, you can see that no arguments were passed along, except for the filename of the executed file (as expected):

[INFO] BEE2_launch.<module>(): Arguments: ['BEE2_launch.pyw']

All of the extra arguments appended to sys.argv (-B, -c , -E, -s, and -S) are valid arguments to CPython (see here) and they seem to isolate the Python-environment (by ignoring Python-related environment-variables, disabling site-packages/ being added to sys.path, and so on). I suspect PyInstaller may be adding them as part of packaging the app in order to ensure that the packaged programme is independent of the system it's run in. I've used PyInstaller before, but that was a while ago and I was never familiar with it beyond "casual" usage, so I can't say for sure.

@TeamSpen210
Copy link
Member

Ahh, it might be the multiprocessing process. Try removing these lines:

if not sys.platform.startswith('win'):
set_start_method('spawn')

@ghost
Copy link
Author

ghost commented May 12, 2021

Commenting out the two highlighted lines sort of worked. Invoking BEE2_launch.pyw directly or running BEE2 after PyInstaller has packaged it doesn't even start the app and instead crashes with the following messages:

[I] utils.setup_localisations(): Language: 'en_GB'
[I] BEE2_launch.<module>(): Arguments: ['./BEE2']
[I] BEE2_launch.<module>(): Running "bee2", version 4.39.2:
[W] img.png(): ERROR: "images/bee2/error.png" does not exist!
[W] img.png(): ERROR: "images/bee2/splash_logo.png" does not exist!
XIO:  fatal IO error 2 (No such file or directory) on X server ":0"
      after 177 requests (177 known processed) with 2 events remaining.
XIO:  fatal IO error 0 (Success) on X server ":0"
      after 1046 requests (1046 known processed) with 0 events remaining.

The above is after running the PyInstaller-packaged BEE2 app; when invoking BEE2_launch.pyw directly, the argument is 'BEE2_launch.pyw'. Notably, however, no extra arguments seem to have been passed in when running the packaged app, so @TeamSpen210's suggestion did work in that regard. Though the app is not running, the problem this issue addressed has technically been solved so I suppose it can be closed.

@TeamSpen210
Copy link
Member

Seems like it's not finding the correct path for the images folder, then crashing when setting the app icon. After this block, you might want to print out _INSTALL_ROOT, see where it thinks the app folder is:

BEE2.4/src/utils.py

Lines 85 to 91 in eba16f1

if FROZEN:
# This special attribute is set by PyInstaller to our folder.
_INSTALL_ROOT = Path(sys._MEIPASS)
else:
# We're running from src/, so data is in the folder above that.
# Go up once from the file to its containing folder, then to the parent.
_INSTALL_ROOT = Path(sys.argv[0]).resolve().parent.parent

@ghost
Copy link
Author

ghost commented May 12, 2021

When invoking with python3: /home/userzeroex/beemod/BEE2.4 (i.e. the "root" folder which contains src/; src/ was also the working directory)
When running the packaged app: /home/userzeroex/beemod/BEE2.4/dist/64bit/BEE2 (again, the folder was also the working directory)

I'd like to highlight these two log-messages:

[W] img.png(): ERROR: "images/bee2/error.png" does not exist!
[W] img.png(): ERROR: "images/bee2/splash_logo.png" does not exist!

images/ definitely exists, but images/bee2/ does not. images/BEE2 does, but since Linux's paths are case-sensitive they're two different places entirely. It makes no difference under Windows since its filesystem is case-insensitive. Sure enough, by renaming images/BEE2/ to images/bee2/, the two errors go away:

_INSTALL_ROOT: /home/userzeroex/beemod/BEE2.4/dist/64bit/BEE2  # My debug-message.
[I] utils.setup_localisations(): Language: 'en_GB'
[I] BEE2_launch.<module>(): Arguments: ['./BEE2']
[I] BEE2_launch.<module>(): Running "bee2", version 4.39.2:
XIO:  fatal IO error 2 (No such file or directory) on X server ":0"
      after 177 requests (177 known processed) with 2 events remaining.
X connection to :0 broken (explicit kill or server shutdown).

@TeamSpen210
Copy link
Member

Aha, yeah I don't handle case sensitivity very well.

@TeamSpen210
Copy link
Member

I suspect the fatal error might be coming from these lines which set the app icon:

# Get the tk image object.
from app import img
app_icon = img.get_app_icon(ICO_PATH)
def set_window_icon(window: Union[tk.Toplevel, tk.Tk]):
"""Set the window icon."""
# Weird argument order for default=True...
window.wm_iconphoto(True, app_icon)

This suggests the icon is too big or something. Try commenting line 79 to turn off the icon-setting, maybe that'll bypass it?

@ghost
Copy link
Author

ghost commented May 13, 2021

No, but the app does seem to get further along:

[I] utils.setup_localisations(): Language: 'en_GB'
[I] BEE2_launch.<module>(): Arguments: ['../dist/64bit/BEE2/BEE2']
[I] BEE2_launch.<module>(): Running "bee2", version 4.39.2:
XIO:  fatal IO error 2 (No such file or directory) on X server ":0"
      after 178 requests (178 known processed) with 2 events remaining.
XIO:  fatal IO error 0 (Success) on X server ":0"
      after 1062 requests (1062 known processed) with 0 events remaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Crash Something is causing the app to crash Linux Issue only applies to Linux
Projects
None yet
Development

No branches or pull requests

3 participants