本文介绍了在名为< string>的文件中“在缩进中使用制表符和空格不一致”的困难的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我已经尝试了几天使用pyObjC在

a mac上构建程序,我坚持这个错误:


< string>:缩进中标签和空格的使用不一致

Traceback(最近一次调用最后一次):

文件setup.py,第59行, ?

setup(** setup_options)

File" /Library/Frameworks/Python.framework/Versions/2.4//lib/

python2.4 / distutils / core.py",第149行,在设置中

dist.run_commands()

文件" /Library/Frameworks/Python.framework/Versions /2.4//lib/

python2.4 / distutils / dist.py",第946行,在run_commands中

self.run_command(cmd)

文件" /Library/Frameworks/Python.framework/Versions/2.4 //lib/

python2.4 / distutils / dist.py",第966行,在run_command中

cmd_obj.run()

文件" /Library/Frameworks/Python.framework/Versions/2.4/lib/

python2.4 / site-packages / py2app / py2app / build_app.py",第342行,在运行中

self.initialize_plist()

文件" /Library/Frameworks/Python.framework/Versions/2.4/lib/

python2.4 / site-packages / py2app / py2app / build_app.py",第415行,在

initialize_plist

plist = self.get_default_plist ()

文件" /Library/Frameworks/Python.framework/Versions/2.4/lib/

python2.4 / site-packages / py2app / py2app / build_app。 py,第294行,

get_default_plist

version = find_version(target.script)

文件" / Library / Frameworks / Python。 framework / Versions / 2.4 / lib /

python2.4 / site-packages / py2app / py2app / util.py",第13行,

find_version

ast = compiler.parseFile(fn)

File" /Library/Frameworks/Python.framework/Versions/2.4//lib/

python2.4 /compiler/transformer.py",第48行,在parseFile中

返回解析(src)

文件" /Library/Frameworks/Python.framework/Ver sions / 2.4 // lib /

python2.4 / compiler / transformer.py",第52行,解析

返回Transformer()。parsesuite(buf)

文件" /Library/Frameworks/Python.framework/Versions/2.4//lib/

python2.4 / compiler / transformer.py",第129行,在parsesuite中

返回self.transform(parser.suite(text))

文件"< string>",第628行

else:

^

语法错误:语法无效


我甚至不知道哪个文件有缩进问题。


任何想法。

Ian Bloom

I''ve been trying for a couple days to build a program using pyObjC on
a mac, I''m stuck on this error:

<string>: inconsistent use of tabs and spaces in indentation
Traceback (most recent call last):
File "setup.py", line 59, in ?
setup(**setup_options)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/distutils/core.py", line 149, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/distutils/dist.py", line 946, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/distutils/dist.py", line 966, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 342, in run
self.initialize_plist()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 415, in
initialize_plist
plist = self.get_default_plist()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 294, in
get_default_plist
version = find_version(target.script)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
ast = compiler.parseFile(fn)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/compiler/transformer.py", line 48, in parseFile
return parse(src)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/compiler/transformer.py", line 52, in parse
return Transformer().parsesuite(buf)
File "/Library/Frameworks/Python.framework/Versions/2.4//lib/
python2.4/compiler/transformer.py", line 129, in parsesuite
return self.transform(parser.suite(text))
File "<string>", line 628
else:
^
SyntaxError: invalid syntax

I don''t even know which file has the indentation problem.

Any thoughts.
Ian Bloom

推荐答案



在该行上方放置一个print语句,以查看哪个文件触发了

错误。


-

Gabriel Genellina

Put a print statement just above that line, to see which file triggers the
error.

--
Gabriel Genellina




也许没有人这样做。由于缩进,缩进错误不一定是
。我上周六刚刚看到一个,但是我不记得是什么原因造成的,除了它不是缩进之外。

有些东西是敞开的,不是正确关闭,例如

匹配()或[]或''''。不幸的是,我无法重现它。

在报告实际的

报告错误之前的部分仔细检查代码。您可能会看到一个症状而不是原因。

Maybe none of them do. An indentation error isn''t necessarily
due to indentation. I just saw one last Saturday, but I don''t
remember what caused it other than it wasn''t indentation.
Something was open that wasn''t closed properly, such as
matching () or [] or ''''. Unfortunately, I can''t reproduce it.
Examine the code carefully in the sections before the actual
reported error. You may be seeing a symptom rather than the cause.



这篇关于在名为&lt; string&gt;的文件中“在缩进中使用制表符和空格不一致”的困难的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:21