Dear Colleagues,
I am having a bit of a problem trying to load the GUI from within a python script. I am new to python, I cannot make sense of the error message and I wonder if it’s related to my setup rather than the GUI itself. I am using a Windows machine with Spyder 4.0.1 and Python 3.7. (I don’t do Jupyter and notebooks.)
After I interrupt the Spyder run with Ctrl+C it seems that port 8080 is stuck so when I try to run the same script from the command line (Anaconda PowerShell Prompt) the browser window is blank. I have to quit Spyder and run the script from the command line to load the GUI.
If I am doing something terribly wrong somewhere would you please point me to the doc page?
The code implements the single neuron demo from HBB.
"""
example 1 chapter 1 of Eliasmith's How to Build a Brain
single neuron model based on a script by s72sue available at
https://github.com/s72sue/Nengo2-Tutorials/tree/master/chapter1
"""
import numpy as np # numerical methods
import nengo # nengo itself
model = nengo.Network( label = 'Single Neuron' )
with model:
cos = nengo.Node( lambda t: np.cos( 16 * t ) )
neuron = nengo.Ensemble( 1, dimensions = 1, encoders = [[1]] )
nengo.Connection( cos, neuron )
import nengo_gui
nengo_gui.GUI(__file__).start()
and the full copy of my console is
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 7.12.0 -- An enhanced Interactive Python.
runfile('C:/Bogdan_root/01_Research/01_VisSidus/09_Neural_engineering/Sims/Nengo_tutorials/H2BB_chapter_1/tutorial1.py', wdir='C:/Bogdan_root/01_Research/01_VisSidus/09_Neural_engineering/Sims/Nengo_tutorials/H2BB_chapter_1')
Starting nengo server accessible at:
http://localhost:8080/?token=4174ecc2def285a5b0827337c8281bfb76733dcd1727d1bc
Exception in thread Thread-7:
Traceback (most recent call last):
File "C:\Users\bogey\Anaconda3\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\bogey\Anaconda3\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
TypeError: open() takes from 1 to 3 positional arguments but 77 were given
Shutting down server...
Traceback (most recent call last):
File "C:\Bogdan_root\01_Research\01_VisSidus\09_Neural_engineering\Sims\Nengo_tutorials\H2BB_chapter_1\tutorial1.py", line 40, in <module>
nengo_gui.GUI(__file__).start()
File "C:\Users\bogey\Anaconda3\lib\site-packages\nengo_gui\gui.py", line 197, in start
super(GUI, self).start()
File "C:\Users\bogey\Anaconda3\lib\site-packages\nengo_gui\gui.py", line 130, in start
self.server.serve_forever(poll_interval=0.02)
File "C:\Users\bogey\Anaconda3\lib\site-packages\nengo_gui\server.py", line 238, in serve_forever
r, _, _ = select.select(sockets, [], [], poll_interval)
KeyboardInterrupt