这个简单的wxpytohn脚本给出了以下错误,怎么了?错误消息不会给出脚本中发生错误的行:
Traceback (most recent call last):
File "c:\Python27\lib\site-packages\spyderlib\plugins\externalconsole.py", line 721, in run_script_in_current_shell
"and try again.") % osp.basename(filename), QMessageBox.Ok)
File "c:\Python27\lib\ntpath.py", line 198, in basename
return split(p)[1]
File "c:\Python27\lib\ntpath.py", line 173, in split
while i and p[i-1] not in '/\\':
TypeError: 'in <string>' requires string as left operand, not QString
脚本如下:
^{pr2}$
问题似乎是
^{pr2}$p[i-1]
是QString
,而Python需要一个字符串。也许是解决问题。在
截至2015年12月,奇怪的是,同样的问题仍然存在,尽管据报道的1540问题已被修复:代码包含(例如)以下行:
在蜘蛛下面跑。在windows中用cmd编译时,会抛出TypeError: TypeError:“in”需要字符串作为左操作数,而不是QString
您可以考虑:
^{pr2}$此here存在spyderlib问题。显然它已经关闭了,所以也许可以尝试更新你的库,看看它是否仍然是个问题。在
Log
相关问题 更多 >
编程相关推荐