Windows的Python 3.x信号库是不完整的?

时间:2009-12-22 20:19:14

标签: python

我使用3.0编写了一个系统脚本,发现在Windows部署中许多其他人都缺少SIGALRM信号和signal.alarm()调用。有谁知道为什么这些丢失了?下面是windows上2.5 vs 3.0信号包的dir()。我还没有找到任何3.0文档,但提到这个被移动了

编辑:信号执行在Windows上的python25中工作,它们在3.0中删除。我应该将我的请求重新命名为'他们去哪里或者变成'或者Windows 3.0发布还没有完成?

python25> python
Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGALRM', 'SIGBUS', 'SIGCHLD', 'SIGCLD',
'SIGCONT', 'SIGEMT', 'SIGFPE', 'SIGHUP', 'SIGILL', 'SIGINT ', 'SIGIO',
'SIGKILL', 'SIGPIPE', 'SIGPOLL', 'SIGPROF', 'SIGQUIT', 'SIGRTMAX',
'SIGRTMIN', 'SIGSEGV', 'SIGSTOP', 'SIGSYS ', 'SIGTERM', 'SIGTRAP',
'SIGTSTP', 'SIGTTIN', 'SIGTTOU', 'SIGURG', 'SIGUSR1', 'SIGUSR2',
'SIGVTALRM', 'SIGWINCH', 'SIGX CPU', 'SIGXFSZ', 'SIG_DFL', 'SIG_IGN',
'__doc__', '__name__', 'alarm', 'default_int_handler', 'getsignal',
'pause', 'sig nal']

>>> exit()
python25> cd ../python31
python31> python
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGBREAK', 'SIGFPE', 'SIGILL', 'SIGINT',
'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_IGN', '__doc__', '__ name__',
'__package__', 'default_int_handler', 'getsignal', 'set_wakeup_fd',
'signal']
>>>

2 个答案:

答案 0 :(得分:3)

Windows是 NOT posix兼容的操作系统,因此它没有所有信号 - 我的猜测是,在3.0上,丢失的信号不再显示在那里。

答案 1 :(得分:3)

看来你正在运行你的2.5 in cygwin,这可能是它出现在那里的原因。

Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin

在我的2.5 for win32中,它看起来就像你的3.1:

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGBREAK', 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_IGN', '__doc__', '__
name__', 'default_int_handler', 'getsignal', 'signal']