calculon
calculon copied to clipboard
bpython crashes w/python3
trafficstars
Hi, I have a fix for this that I can do a PR for in a bit (still testing).
The issue is that bpython crashes after importing calculon on python 3.5.3 and above after having started a 'display' already for calculon. This seems related to a difference in python v2.7 vs v3+ object instantiation rules.
Note that I use pyenv but the issue occurs at system level as well -so it's not environmental. here's the console side error:
$ bpython
bpython version 0.17.1 on top of Python 3.6.6 /home/karl/.pyenv/versions/3.6.6/bin/python3.6
>>> import calculon.load
Connected to calculon
>>> 1
Traceback (most recent call last):
File "/home/karl/.pyenv/versions/3.6.6/bin/bpython", line 11, in <module>
sys.exit(main())
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsies.py", line 191, in main
exit_value = repl.mainloop(True, paste)
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsies.py", line 126, in mainloop
self.process_event_and_paint(e)
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsies.py", line 90, in process_event_and_paint
self.process_event(e)
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/repl.py", line 603, in process_event
return self.process_key_event(e)
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/repl.py", line 732, in process_key_event
self.on_enter()
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/repl.py", line 817, in on_enter
self.push(self.current_line, insert_into_history=insert_into_history)
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/repl.py", line 1087, in push
self.run_code_and_maybe_finish()
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/repl.py", line 1090, in run_code_and_maybe_finish
r = self.coderunner.run_code(for_code=for_code)
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/coderunner.py", line 138, in run_code
request = self.code_context.switch()
File "/home/karl/.pyenv/versions/3.6.6/lib/python3.6/site-packages/bpython/curtsiesfrontend/coderunner.py", line 180, in _blocking_run_code
unfinished = self.interp.runsource(self.source)
File "/home/karl/.local/lib/python3.6/site-packages/calculon_calc-0.2-py3.6.egg/calculon/repl.py", line 163, in runsource
self.locals['disp'] = disp
NameError: name 'disp' is not defined