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

Unstable behavior if there's no controlling terminal #1389

Open
VanessaE opened this issue Nov 2, 2023 · 4 comments
Open

Unstable behavior if there's no controlling terminal #1389

VanessaE opened this issue Nov 2, 2023 · 4 comments

Comments

@VanessaE
Copy link
Contributor

VanessaE commented Nov 2, 2023

I'm using Pronterface 2.0.0rc8 from Debian Bookworm repository, desktop environment is XFCE 4.18.

If Pronterface is started in such a way that there is no controlling terminal to which the program can send its usual output, it....um....gets upset 😛 and throws errors to its own console like crazy. For example, this happens at startup:

Connecting...
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/__init__.py", line 1114, in emit
    self.flush()
  File "/usr/lib/python3.11/logging/__init__.py", line 1094, in flush
    self.stream.flush()
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 112, in flush
    self.stdout.flush()
OSError: [Errno 5] Input/output error
Call stack:
  File "/usr/bin/pronterface", line 64, in <module>
    app.MainLoop()
  File "/usr/lib/python3/dist-packages/wx/core.py", line 2262, in MainLoop
    rv = wx.PyApp.MainLoop(self)
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 1187, in connectbtn_cb
    self.connectbtn_cb_var()
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 1190, in connect
    self.log(_("Connecting..."))
  File "/usr/lib/python3/dist-packages/printrun/pronsole.py", line 293, in log
    logging.info(msg)
Message: 'Connecting...'
Arguments: ()
Printer is now online.
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/__init__.py", line 1114, in emit
    self.flush()
  File "/usr/lib/python3.11/logging/__init__.py", line 1094, in flush
    self.stream.flush()
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 112, in flush
    self.stdout.flush()
OSError: [Errno 5] Input/output error
Call stack:
  File "/usr/lib/python3.11/threading.py", line 995, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 418, in _listen
    self._listen_until_online()
  File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 409, in _listen_until_online
    try: self.onlinecb()
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 1743, in online
    self.log(_("Printer is now online."))
  File "/usr/lib/python3/dist-packages/printrun/pronsole.py", line 293, in log
    logging.info(msg)
Message: 'Printer is now online.'
Arguments: ()
SENDING:G1 Z275 F12000
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.11/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PronterWindow' object has no attribute 'do_G1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/__init__.py", line 1114, in emit
    self.flush()
  File "/usr/lib/python3.11/logging/__init__.py", line 1094, in flush
    self.stream.flush()
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 112, in flush
    self.stdout.flush()
OSError: [Errno 5] Input/output error
Call stack:
  File "/usr/bin/pronterface", line 64, in <module>
    app.MainLoop()
  File "/usr/lib/python3/dist-packages/wx/core.py", line 2262, in MainLoop
    rv = wx.PyApp.MainLoop(self)
  File "/usr/lib/python3/dist-packages/printrun/pronterface.py", line 2256, in process_button
    self.onecmd(command)
  File "/usr/lib/python3.11/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/usr/lib/python3/dist-packages/printrun/pronsole.py", line 398, in default
    self.log("SENDING:" + l.upper())
  File "/usr/lib/python3/dist-packages/printrun/pronsole.py", line 293, in log
    logging.info(msg)
Message: 'SENDING:G1 Z275 F12000'
Arguments: ()

Many of the buttons and widgets also emit similar error messages, though they DO work.

If I start a print, that works too, despite the errors.

However, if I send a command to the printer, whether a print is going or not, the entire UI deadlocks. If there's a print going, it keeps on going, at least for a while, so the underlying USB comms and control still works just fine, only the UI dies. See also #1392.

This wasn't a problem under Debian Bullseye, but I'm using Bookworm now, so apparently something has changed in the system such that there's no default system console or other sink for terminal messages to go to, or at least whatever it is now isn't to Pronterface's liking.

All of this goes away if I simply launch the program from an ordinary terminal, so I've tweaked my desktop's launcher to do just that. A terminal is super fast to start and to exit, that terminal is minimized at launch since I don't need to see it, and it goes away on its own when Pronterface exits, so the only downside of this workaround is that I end up with an extra terminal item in my panel/taskbar when Pronterface is running.

Steps to reproduce:

  1. Install a Debian Bookworm system 😁
  2. install pronterface from its repository
  3. install XFCE
  4. Add a launcher to your panel which starts pronterface with no arguments.
  5. Launch it and connect to a printer.
  6. Commence hair-pulling.
@VanessaE VanessaE changed the title Unstable behavior and/or deadlock, if there's no controlling terminal Unstable behavior if there's no controlling terminal Nov 21, 2023
@DivingDuck
Copy link
Collaborator

Hi,
Question: what version of wxPython is installed?

Here is a list what I have installed for the windows version. Some of them differ to Linux, please take a look to file requirments.txt.

pyglet version should be 1.5.27 and wxPython version should be 4.2.1.
In addition I'm not sure if Python version 3.11 works fine. Most test was done with 3.10. It is maybe a good idea to set up a virtual environment for Pronterface as described in file readme.md
pronterface_pip#1389

@VanessaE
Copy link
Contributor Author

Hi, Question: what version of wxPython is installed?

Here is a list what I have installed for the windows version. Some of them differ to Linux, please take a look to file requirments.txt.

pyglet version should be 1.5.27 and wxPython version should be 4.2.1. In addition I'm not sure if Python version 3.11 works fine.

Looks like wxPython is at 4.2.0. Pyglet is at 1.5.27, and the system runs Python 3.11 by default.

Most test was done with 3.10. It is maybe a good idea to set up a virtual environment for Pronterface as described in file readme.md !

Wouldn't that only apply if I were running my own build? I'm not - I'm running the package found in the Debian Bookworm repo. The above are what got pulled-in when I installed it.

@DivingDuck
Copy link
Collaborator

Wouldn't that only apply if I were running my own build? I'm not - I'm running the package found in the Debian Bookworm repo. The above are what got pulled-in when I installed it.

Correct and this is why it will not run w/o errors. This is why @rockstorm101, Issue #1390, and I recommend to run Pronterface from actual source files with virtual environment. W/o this workaround it will not run with Debian. More I can't offer for now.

@VanessaE
Copy link
Contributor Author

Correct and this is why it will not run w/o errors. This is why @rockstorm101, Issue #1390, and I recommend to run Pronterface from actual source files

Which I would be doing if I could.

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

No branches or pull requests

2 participants