Closed rht closed 3 years ago
I reran this on latest version of flexx. No longer observed any errors.
The unit tests worked, but some of the examples don't work with the gui. Reopening.
I'm facing the same error (most likely caused by flexx). I tried using the newest version of flexx and tornado as well as the versions specified by abcEconomics.
Traceback (most recent call last):
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\commonast.py", line 764, in _convert
converter = getattr(self, '_convert_' + type)
AttributeError: 'NativeAstConverter' object has no attribute '_convert_Constant'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/mschlechtinger/PycharmProjects/abcE/main.py", line 4, in <module>
from abcEconomics import Simulation, gui
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\abcEconomics\gui\__init__.py", line 6, in <module>
from flexx import app
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\app\__init__.py", line 79, in <module>
from .session import manager, Session
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\app\session.py", line 8, in <module>
from .model import Model, new_type
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\app\model.py", line 76, in <module>
from ..event._js import create_js_hasevents_class, HasEventsJS
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\event\_js.py", line 178, in <module>
HasEventsJS.JSCODE = get_HasEvents_js()
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\event\_js.py", line 157, in get_HasEvents_js
jscode = py2js(HasEventsJS, 'HasEvents')
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\event\_js.py", line 23, in py2js
return py2js_(*args, **kwargs)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\functions.py", line 83, in py2js
return py2js_(ob)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\functions.py", line 69, in py2js_
p = Parser(pycode, **parser_options)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\parser0.py", line 195, in __init__
self._root = ast.parse(code)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\commonast.py", line 35, in parse
return converter.convert(comments)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\commonast.py", line 747, in convert
node = self._convert(native_node)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\commonast.py", line 768, in _convert
val = converter(n)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\commonast.py", line 858, in _convert_Expr
return Expr(self._convert(n.value))
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flexx\pyscript\commonast.py", line 766, in _convert
raise RuntimeError('Cannot convert %s nodes.' % type)
RuntimeError: Cannot convert Constant nodes.
@mschlechtinger if you want a quick workaround, you can clone the repo, then change this line to ==
instead of >=
.
@rht thanks for the reply! I already tried manually downloading flexx 0.4.1 as well as cloning + changing the repo but I'm always encountering the same error when I try to import the gui from abcEconomics.
this is the result of a pip freeze:
abcEconomics==0.9.7b2
alembic==1.4.2
banal==1.0.1
bkcharts==0.2
bokeh==0.12.16
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
Cython==0.29.21
dataset==0.8.0
dialite==0.5.2
flexx==0.4.1
future==0.18.2
idna==2.10
Jinja2==2.11.2
jsonpointer==2.0
Mako==1.1.3
MarkupSafe==1.1.1
normality==0.6.1
numpy==1.19.1
packaging==20.4
pandas==1.1.0
pscript==0.7.4
PyNSim==0.1.5
pyparsing==2.4.7
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2020.1
PyYAML==5.3.1
requests==2.24.0
rfc3987==1.3.8
six==1.15.0
SQLAlchemy==1.3.18
strict-rfc3339==0.7
tornado==4.3
urllib3==1.25.10
validate-email==1.3
webruntime==0.5.7
I found the error reported here: https://github.com/flexxui/flexx/issues/608. It is strange that the solution is to update to pscript 0.7.3, but you already have pscript 0.7.4. The other solution is to downgrade Python to 3.7, which is kind of annoying to do.
Maybe you shouldn't use gui
for now.
@rht thanks a lot for the support! Downgrading helps to start the gui atm. However, I am not able to start the simulation because I'm encountering a similar error:
ERROR flexx.event:
Traceback (most recent call last):
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python37\lib\site-packages\abcEconomics\gui\basiclayout.py", line 139, in display_results
path = events['subdir']
KeyError: 'subdir'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python37\lib\site-packages\flexx\event\_handler.py", line 251, in handle_now
self(*events)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python37\lib\site-packages\flexx\event\_handler.py", line 204, in __call__
res = func(*events)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python37\lib\site-packages\abcEconomics\gui\basiclayout.py", line 104, in run_simulation
self.display_results(events, abcEconomics.simulation_name)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python37\lib\site-packages\abcEconomics\gui\basiclayout.py", line 141, in display_results
path = newest_subdirectory('./result', simulation_name)
File "C:\Users\mschlechtinger\AppData\Local\Programs\Python\Python37\lib\site-packages\abcEconomics\gui\basiclayout.py", line 199, in newest_subdirectory
raise Exception()
Exception
I hope flexx will fix this issue in the next couple of releases. I will probably just use abcE without the gui
for now.
simulation.graphs()
, @gui
, etc are now obsolete. If anyone wants to do GUI they can do it via the mature Jupyter widgets.
The
flexx
API has changed.