python 问题

wxgiter 2010-05-10 10:30:40
D:\BitTorrent-4.0.3>python btdownloadheadless.py --url http://10.16.29.224/KuroKy.mp4.torrent --save
_as D:\BitTorrent-4.0.3\KuroKy.mp4
Traceback (most recent call last):
File "btdownloadheadless.py", line 21, in <module>
from signal import signal, SIGWINCH
ImportError: cannot import name SIGWINCH


用bittorrent搭建BT服务器,注册种子文件时提示这个错误,怎么解决?

bittorrent-4.0.3这有下载:http://download.csdn.net/source/820364
...全文
207 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
一土草三工 2010-05-11
  • 打赏
  • 举报
回复
不太了解,帮顶
thy38 2010-05-11
  • 打赏
  • 举报
回复
貌似这个东东要注册:
_registered_sigwinch = False

def watch_sigwinch():
"""Register for SIGWINCH, once and only once."""
"""Register for SIGWINCH, once and only once.

Do nothing if the signal module is not available.
"""
global _registered_sigwinch
if not _registered_sigwinch:
if sys.platform == 'win32':
# Martin (gz) mentioned WINDOW_BUFFER_SIZE_RECORD from
# ReadConsoleInput but I've no idea how to plug that in
# the current design -- vila 20091216
try:
import signal
if getattr(signal, "SIGWINCH", None) is not None:
set_signal_handler(signal.SIGWINCH, terminal_size_changed)
except ImportError:
# python doesn't provide signal support, nothing we can do about it
pass
else:
set_signal_handler(signal.SIGWINCH, _terminal_size_changed)
_registered_sigwinch = True
wxgiter 2010-05-11
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 notax 的回复:]
楼上说的是

python 2.5 on windows
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGBREAK', 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTER
M', 'SIG_DFL', 'SIG_IGN', '__doc__', '__name__', '……
[/Quote]
这样啊..
悲剧了..
多谢大家回复.
huanlanshikong 2010-05-11
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 notax 的回复:]

楼上说的是

python 2.5 on windows
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGBREAK', 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTER
M', 'SIG_DFL', 'SIG_IGN', '__doc__', '__name__', ……
[/Quote]

原来这样啊,学习了
notax 2010-05-11
  • 打赏
  • 举报
回复
楼上说的是

python 2.5 on windows
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGBREAK', 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTER
M', 'SIG_DFL', 'SIG_IGN', '__doc__', '__name__', 'default_int_handler', 'getsign
al', 'signal']
>>>

on linux
>>> import signal
>>> dir(signal)
['NSIG', 'SIGABRT', 'SIGALRM', 'SIGBUS', 'SIGCHLD', 'SIGCLD', 'SIGCONT', 'SIGFPE', 'SIGHUP', 'SIGILL', 'SIGINT', 'SIGIO', 'SIGIOT', 'SIGKILL', 'SIGPIPE', 'SIGPOLL', 'SIGPROF', 'SIGPWR', 'SIGQUIT', 'SIGRTMAX', 'SIGRTMIN', 'SIGSEGV', 'SIGSTOP', 'SIGSYS', 'SIGTERM', 'SIGTRAP', 'SIGTSTP', 'SIGTTIN', 'SIGTTOU', 'SIGURG', 'SIGUSR1', 'SIGUSR2', 'SIGVTALRM', 'SIGWINCH', 'SIGXCPU', 'SIGXFSZ', 'SIG_DFL', 'SIG_IGN', '__doc__', '__name__', 'alarm', 'default_int_handler', 'getsignal', 'pause', 'signal']
>>>




angel_su 2010-05-11
  • 打赏
  • 举报
回复
可能是平台相关的,windows下不能使的吧...
wxgiter 2010-05-11
  • 打赏
  • 举报
回复
我把3楼的代码放在btdownloadheadless.py 这个文件里还是同样的错误...
flamkuavos 2010-05-10
  • 打赏
  • 举报
回复
呵呵,帮顶吧
winbsd 2010-05-10
  • 打赏
  • 举报
回复
引用错误,就是少相关类文件了,不过不知道SIGWINCH要下哪个文件

37,721

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧