Open dbzhao opened 6 years ago
I'm getting this, too. I can run the examples from bash just fine, but if I try to run that same code from ipython or jupyter, I immediately get that "AttributeError: module 'builtins' has no attribute 'exit'" error.
Worse, it looks like it's exiting immediately, whereas running from bash does not. Perhaps an issue with the vispy module, not happy with the Python REPL and notebook environment?
FWIW, I'm using the latest and greatest Anaconda Python 3.6.5 distro on Mac 10.13.6.
@dbzhao, thanks for bringing this up. The behavior does seems a little odd. Could you try two things:
>>> import builtins
>>> 'exit' in dir(builtins)
C:\Users\Daniel\AppData\Roaming\Python\Python35\site-packages\p5\sketch\userspace.py
and commenting out line 220 (this is where p5 is trying to call builtins.exit()
and then failing)?but if I try to run that same code from ipython or jupyter, I immediately get that "AttributeError: module 'builtins' has no attribute 'exit'" error.
We haven't done any testing on running sketches from within Jupyter. It would be very neat to have Jupyter, though. We just haven't gotten the time to work on it. I won't have the time over the next couple of months, but is someone wants to dig into this, feel free!
Perhaps an issue with the vispy module,
Possible. They have been experimenting with adding support for Jupyter notebooks, I don't think there's anything stable enough currently.
I'm also using anaconda, so i wrote
import builtins builtins.exit()
still the same error its as if the compiler cannot access the exit attribute in builtins
Any ideas how to fix it ?
@abhikpal @dbzhao @johndavidmiller
I had the same issue with anaconda, i like to use Spyder.
As a workaround you can just execute the script via conda prompt, e.g. 'python C:Code\p5_tutorial.py' and it works like a charm.
avec ide anaconda Python 3.7.4 64-bit | Qt 5.9.6 | PyQt5 5.9.2 | Windows 10 .
AttributeError: module 'p5.core.p5' has no attribute 'exit'
sous anaconda prompt, p5 fonctionne
une erreur est générée avec la fonction no_smooth()
I'm getting the same error when i try to run the sample code provided in the README... Please help.. Im using python 3.7 in Spyder 4 environment to run my python p5 code...
The error:
WARNING: Traceback (most recent call last):
File "C:\Users\Lenovo\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\Users\Lenovo\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Lenovo\anaconda3\lib\site-packages\spyder_kernels\console__main.py", line 11, in
File "C:\Users\Lenovo\Documents\Python Scripts\double_pendulum.py", line 27, in
File "C:\Users\Lenovo\anaconda3\lib\site-packages\p5\sketch\userspace.py", line 160, in run exit()
File "C:\Users\Lenovo\anaconda3\lib\site-packages\p5\sketch\userspace.py", line 241, in exit p5.exit(*args, **kwargs)
AttributeError: module 'p5.core.p5' has no attribute 'exit'
Hi getting same result when running from Jupyter Notebook Runs OK if I call it directly python c:\code\flocking.py as noted by pzanazzi commented on Jan 10, 2019
I take it there has been no research on running in Jupyter
There seems to have been some work in resolving vispy with Jupyter Notebooks vispy.plot not working in Jupyter notebook #1312 https://github.com/vispy/vispy/issues/1312
Describe the bug I've been getting an
AttributeError: module 'builtins' has no attribute 'exit'
error whenever I try to run the example in the README. I've tried installing on a different machine with a different OS and am getting the same error. Any ideas on what could be the issue? Let me know if any additional info would help. Thanks!To Reproduce Just trying to run the example on the README:
Errors produced
System information:
Was also able to replicate on: