matplotlib: error in sys.exitfunc

  • Last Update :
  • Techknowledgy :
1._
plt.plot(return_array, risk_array)
plt.title('Pareto Front for ' + r '$\lambda \in$ [0.0, 1.0]')
plt.xlabel('Return')
plt.ylabel('Risk')
plt.axis([0.02, 0.05, 0.01, 0.016])

only using above code gives error but adding

matplotlib.pyplot.show()
cd matplotlib - 1.3 .1

sudo python setup.py install

before that install following

sudo apt - get install libfreetype6 - dev

sudo apt - get install python - dev

sudo apt - get install libevent - dev

sudo apt - get install libpng - dev

This is my horrible hack to get around it:

 import matplotlib.pyplot as plt

 # your use of matplotlib here where you don 't use the plot.show() function

 try:
 plt.close()
 except AttributeError, e:
    pass

Suggestion : 2

Since core-8.3.0~989, running a python-script with kopano-module imported, asserts with message “Error in sys.exitfunc:”. Regardless, the script executes sucessfully.

Example:

[tadao@ando python-kopano]# ./list-users.py
sepp
xav
hias
maxe
gustl
bede
fax
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib64/python2.6/atexit.py", line 28, in _run_exitfuncs
import traceback
File "/usr/lib64/python2.6/traceback.py", line 3, in <module>
   import linecache
   File "/usr/lib64/python2.6/linecache.py", line 9, in <module>
      import os
      File "/usr/lib64/python2.6/os.py", line 119, in <module>
         sys.modules['os.path'] = path
         AttributeError: 'module' object has no attribute 'modules'

Suggestion : 3

This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide.,Created on 2007-03-14 19:51 by georg.brandl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

This removes sys.exitfunc.atexit is rewritten in C and uses as much of the existing sys.exitfunc - infrastructure(which is renamed).
The attached patch didn 't apply cleanly for me; the hunk that removes call_sys_exitfunc (pythonrun.c) failed, but everything else applied just fine.  I removed call_sys_exitfunc manually and then everything compiled and passes regrtest.py (with -r -u all) with no unexpected skips (Linux).  

The docs also build just fine and I don 't see any grammatical/formatting errors or anything that jumps out as a technical error (but I'
m not all that familiar with atexit / exitfunc, so take my endorsement with a grain of salt;).
Note that the patch is against the p3yk branch.

Note also that, without changing Modules / Setup, the new module won 't be built and used.
In fact, the test suite doesn 't pass with it since I haven'
t updated the tests that
depend on atexit._exithandlers.

But thanks
for reviewing nonetheless!
Ack, I didn 't know you were working on this, too! I'
m attaching my own atexit implementation;
the patch includes changes to Modules / Setup, test_atexit and test___all__ so that the test suite passes.

One thing I 'm not sure about is that I'
ve moved call_ll_exitfuncs() up in the order of Py_Finalize().This was necessary to make PyThreadState_GET() stop complaining about "no current thread"
when calling the atexit functions at interpreter - shutdown, but I don 't know enough to be sure that this change doesn'
t alter some assumption about finalization order.It looks alright to me, and "make test"
passes, but I 'd appreciate it if someone could look over that part.
File Added: atexit.patch
To summarize the differences: your code uses a C array to store the exit handlers, mine uses a Python list.
Which to choose obviously depends on whether you want to make the list available to Python code...
Another difference: mine uses Py_AtExit(), yours adds extra C functions like Py_SetPythonExitfunc() and call_python_exitfunc().

I 'd vote against exposing the handler list to Python code. I see that leading to "run my handler first! No, mine! *scuffle*" games.

Suggestion : 4

I'm using django-admin.py runserver and when I edit code, the autoreload module kicks in, and everything works fine, but I repeatedly get this error: ,The web framework for perfectionists with deadlines., I'm not facing problems because of this since the new code *is* being used, but maybe this 'issue' might cause concerns in other situations?

I'm using django-admin.py runserver and when I edit code, the autoreload module kicks in, and everything works fine, but I repeatedly get this error:

Error in atexit._run_exitfuncs:
   Traceback(most recent call last):
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
func( * targs, ** kargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/threading.py", line 636, in __exitfunc
self._Thread__delete()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/threading.py", line 522, in __delete
del _active[_get_ident()]
KeyError: -1610551400
Error in sys.exitfunc:
   Traceback(most recent call last):
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
func( * targs, ** kargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/threading.py", line 636, in __exitfunc
self._Thread__delete()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/threading.py", line 522, in __delete
del _active[_get_ident()]
KeyError: -1610551400
Validating models...
   0 errors found.

Starting server on port 8123 with settings module 'myproject.settings.admin'.
Go to http: //127.0.0.1:8123/ for Django.
   Quit the server with CONTROL - C(Unix) or CTRL - BREAK(Windows).
   [07 / Sep / 2005 14: 13: 01]
"GET /admin/ HTTP/1.1"
200 3210