AttributeError: 'NoneType' object has no attribute 'fileno'

73 views
Skip to first unread message

Kayla Jane Rodriguez

unread,
Dec 5, 2024, 2:06:28 PM12/5/24
to the labscript suite
Hi, I recently uninstalled the conda developer version and installed BLACS via pip devloper instructions. When I open BLACS, a bunch of pop ups open and close immediately. My biggest problem is when I remove commented out device on the connection table then BLACs isn't able to open and I get the following error as well as a zlock error when I keep the comments in connection table:

Traceback (most recent call last):

  File "C:\Users\schinelab\labscript-suite\blacs\blacs\__main__.py", line 71, in <module>

    logger = setup_logging('BLACS')

             ^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\schinelab\labscript-suite\labscript-utils\labscript_utils\setup_logging.py", line 60, in setup_logging

    stdout_fileno = sys.stdout.fileno()

                    ^^^^^^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'fileno'


comments back in:


Traceback (most recent call last):
  File "C:\Users\schinelab\labscript-suite\blacs\blacs\__main__.py", line 756, in <module>
    experiment_server = ExperimentServer(port)
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\schinelab\labscript-suite\labscript-utils\labscript_utils\ls_zprocess.py", line 190, in __init__
    zprocess.ZMQServer.__init__(
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\clientserver.py", line 483, in __init__
    _ZMQServer.__init__(self, port, dtype=dtype, pull_only=pull_only,
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\clientserver.py", line 137, in __init__
    self.sock.bind('%s:%d' % (self.bind_address, self.port))
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\security.py", line 217, in bind
    return self._bind_or_connect(addr, bind=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\security.py", line 204, in _bind_or_connect
    result = method(self, addr)
             ^^^^^^^^^^^^^^^^^^
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zmq\sugar\socket.py", line 311, in bind
    super().bind(addr)
  File "_zmq.py", line 917, in zmq.backend.cython._zmq.Socket.bind
  File "_zmq.py", line 179, in zmq.backend.cython._zmq._check_rc
zmq.error.ZMQError: Address in use (addr='tcp://*:42517')
  File "C:\Users\schinelab\labscript-suite\blacs\blacs\__main__.py", line 756, in <module>
    experiment_server = ExperimentServer(port)
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\schinelab\labscript-suite\labscript-utils\labscript_utils\ls_zprocess.py", line 190, in __init__
    zprocess.ZMQServer.__init__(
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\clientserver.py", line 483, in __init__
    _ZMQServer.__init__(self, port, dtype=dtype, pull_only=pull_only,
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\clientserver.py", line 137, in __init__
    self.sock.bind('%s:%d' % (self.bind_address, self.port))
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\security.py", line 217, in bind
    return self._bind_or_connect(addr, bind=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zprocess\security.py", line 204, in _bind_or_connect
    result = method(self, addr)
             ^^^^^^^^^^^^^^^^^^
  File "C:\Users\schinelab\labscript-suite\.venv\Lib\site-packages\zmq\sugar\socket.py", line 311, in bind
    super().bind(addr)
  File "_zmq.py", line 917, in zmq.backend.cython._zmq.Socket.bind
  File "_zmq.py", line 179, in zmq.backend.cython._zmq._check_rc
zmq.error.ZMQError: Address in use (addr='tcp://*:42517')



Chris Billington

unread,
Dec 5, 2024, 6:00:31 PM12/5/24
to labscri...@googlegroups.com
Hi Kayla,

The "Address in use" error suggests either that BLACS is still running (perhaps in the background, having not shut down properly even though no window is visible), or sometimes that it didn't shut down properly and there's something like a half-hour lockout before it's allowed to re-using the same TCP port in certain circumstances (I'm unsure exactly what circumstances trigger this, but I see it sometimes). In the first case you might find BLACS in Windows' task manager and terminate it, and a reboot should address both possibilities.

As for the `NoneType' object has no attribute 'fileno'` error, I'm not sure about that one. What version of Windows, and what version of Python are you using? Is it Python downloaded from python.org, or from the Microsoft Store? When you see these errors, are you launching BLACS from the command line, or from a start menu launcher (and you're seeing the error in a popup window)?

It seems unlikely (though stranger things have happened) that these errors would have to do with the exact content of your connection table, I would expect if you're seeing varying behaviour from one restart of BLACS to the next, it'd more likely be because of some other state-dependence like background processes still running or the TCP port being reserved for a period of time.

Regards,

Chris
 

--
You received this message because you are subscribed to the Google Groups "the labscript suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to labscriptsuit...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/labscriptsuite/014671eb-3baf-4d86-9e82-f7e656278c17n%40googlegroups.com.

Kayla Jane Rodriguez

unread,
Dec 5, 2024, 6:22:23 PM12/5/24
to the labscript suite
Yea the NoneType error is the most annoying - I have tried on two separate windows machines.

1. I have windows 11
2. For the python version, I installed via the .org and checked the virtual environment is 3.11.9
(.venv) C:\Users\Schinelab\labscript-suite>python --version
Python 3.11.9

3. I am seeing this error when I go to the start menu option. I installed via pip through a python virtual environment, when I run it directly from virtual environment folder (labscript-suite\.venv\Scripts) and run blacs exe I do not get the error

Yes, the contents of connection table do not matter, I checked this and this just happens when opening and changing connection table and so I close and then reopen BLACS and get the same error but it opens this time instead of crashing

dihm....@gmail.com

unread,
Dec 11, 2024, 10:45:44 AM12/11/24
to the labscript suite
 From what I remember when trying to debug this when I was in your lab last week, the NoneType error is throwing because sys.stdout is not defined (for some reason) when BLACS relaunches itself after being started by the start menu launcher (probably related to this note in the python docs). I was a little worried it might be an OS thing in how the hidden terminal launches work, so I tried to reproduce on Windows 10 (python=3.11.7) and Windows 11 (python=3.11.10) machines, both with fresh conda developer installations: and relauches work fine. Maybe it is some very subtle interaction between how desktop-app creates the launchers and something specific to either pip venv or even your local computer.

Could you send direct (or post) your pip list? Just in case there is some very specific package version at play.
-David

Message has been deleted

Kayla Jane Rodriguez

unread,
Jan 2, 2025, 10:46:26 AMJan 2
to the labscript suite
Hi David, 

Sorry for the delayed reply. Here is my pip list

C:\Users\schinelab\labscript-suite> .venv\Scripts\activate

(.venv) C:\Users\schinelab\labscript-suite>pip list
Package                Version              Editable project location
---------------------- -------------------- ----------------------------------------------------
asttokens              2.4.1
blacs                  3.3.0.dev11          C:\Users\schinelab\labscript-suite\blacs
colorama               0.4.6
contourpy              1.3.1
cycler                 0.12.1
decorator              5.1.1
desktop-app            0.4.1
distlib                0.3.9
executing              2.1.0
fonttools              4.55.0
genicam                1.4.0
h5py                   3.12.1
harvesters             1.4.3
importlib_metadata     8.5.0
ipython                8.29.0
jedi                   0.19.2
kiwisolver             1.4.7
labscript              3.4.0.dev42          C:\Users\schinelab\labscript-suite\labscript
labscript-c-extensions 1.2.0
labscript-devices      3.3.0.dev41          C:\Users\schinelab\labscript-suite\labscript-devices
labscript-utils        3.4.0.dev24          C:\Users\schinelab\labscript-suite\labscript-utils
lyse                   3.3.0.dev39+gb272f50 C:\Users\schinelab\labscript-suite\lyse
matplotlib             3.9.2
matplotlib-inline      0.1.7
numpy                  2.1.3
packaging              24.2
pandas                 2.2.3
parso                  0.8.4
pillow                 11.0.0
pip                    24.3.1
prompt_toolkit         3.0.48
pure_eval              0.2.3
PyDAQmx                1.4.6
Pygments               2.18.0
pynivision             2015.0.0
pyparsing              3.2.0
PyQt5                  5.15.11
PyQt5-Qt5              5.15.2
PyQt5_sip              12.15.0
pyqtgraph              0.13.7
pyserial               3.5
python-dateutil        2.9.0.post0
pytz                   2024.2
PyVISA                 1.14.1
pywin32                308
pyzmq                  26.2.0
qtutils                3.1.0
runmanager             3.3.0.dev13          C:\Users\schinelab\labscript-suite\runmanager
runviewer              3.3.0.dev23          C:\Users\schinelab\labscript-suite\runviewer
scipy                  1.14.1
setuptools             75.6.0
setuptools-scm         8.1.0
six                    1.16.0
spinapi                3.2.2
stack-data             0.6.3
tqdm                   4.67.0
traitlets              5.14.3
typing_extensions      4.12.2
tzdata                 2024.2
tzlocal                5.2
wcwidth                0.2.13
wheel                  0.45.0
windows-curses         2.4.0
zipp                   3.21.0
zprocess               2.25.0
Reply all
Reply to author
Forward
0 new messages