there is no exitfunc in sys module

H

Hameed Khan

hi,
i was reading the manual for sys module. i found a
description for a function known as exitfunc. and it
says the function installed by
sys.exitfunc(cleanUpFunc) call will be called when the
interpreter exits. but when i try to call this
function on Python interactive prompt it says there is
no attribute named exitfunc in sys module.

###Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute
'exitfunc'['__displayhook__', '__doc__', '__excepthook__',
'__name__', '__stderr__', '__stdin__', '__stdout_
_', '_getframe', 'api_version', 'argv',
'builtin_module_names', 'byteorder', 'call_tracing',
'call
stats', 'copyright', 'displayhook', 'dllhandle',
'exc_clear', 'exc_info', 'exc_type', 'excepthook'
, 'exec_prefix', 'executable', 'exit',
'getcheckinterval', 'getdefaultencoding',
'getfilesystemenc
oding', 'getrecursionlimit', 'getrefcount',
'getwindowsversion', 'hexversion', 'last_traceback', '
last_type', 'last_value', 'maxint', 'maxunicode',
'meta_path', 'modules', 'path', 'path_hooks', 'p
ath_importer_cache', 'platform', 'prefix', 'ps1',
'ps2', 'setcheckinterval', 'setprofile', 'setrec
ursionlimit', 'settrace', 'stderr', 'stdin', 'stdout',
'version', 'version_info', 'warnoptions', '
winver']
###

i am wondering that only i dont have this in my sys
module or it is being deleted from sys module. and if
only i dont have this function what reason it could be
that i dont have this function.

### Version information'2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit
(Intel)]'

Thanks,
Hameed Khan

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
 
T

Terry Carroll

i was reading the manual for sys module. i found a
description for a function known as exitfunc. and it
says the function installed by
sys.exitfunc(cleanUpFunc) call will be called when the
interpreter exits. but when i try to call this
function on Python interactive prompt it says there is
no attribute named exitfunc in sys module.

It doesn't exist by default. It's a function that you set up to be
called at termination. Try this::

import sys

def outtahere():
print "Okay, I quit"

sys.exitfunc=outtahere

print "program starting"
# do something
print "program done, now exiting"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top