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.
>
> Any thoughts.
> Ian Bloom

Re: Difficulty with "inconsistent use of tabs and spaces inindentation" in file called <string>

ibloom wrote:
> My main problem is, I don't know where to find the file:
> File "<string>", line 628
>
> As in I don't know what code it is refering to by <string> ??
> It isn't code that I wrote, its something from python or pyObjC
>
You'll typically see that in code that's being executed from a
dynamically created string in the code, which is going to make it *very*
difficult to debug.
>>> exec "1/0"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
>>> eval('1/0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
>>>

Re: Difficulty with "inconsistent use of tabs and spaces inindentation" in file called <string>

En Mon, 11 Feb 2008 21:57:00 -0200, ibloom <> escribió:
> My main problem is, I don't know where to find the file:
> File "<string>", line 628
>
> As in I don't know what code it is refering to by <string> ??
> It isn't code that I wrote, its something from python or pyObjC

In case it wasn't clear, modify the file
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/py2app/util.py,
around line 13, in the find_version function, adding this print statement:

print 'about to compile', fn
ast = compiler.parseFile(fn)

The last line printed (in case there are many) should be the offending
filename.

Of course you don't have to keep the modified library, this is just to
detect which file triggers the error. You should report this to the py2app
developers as well.

Re: Difficulty with "inconsistent use of tabs and spaces inindentation" in file called <string>

On Feb 11, 9:10 pm, "Gabriel Genellina" <>
wrote:
> En Mon, 11 Feb 2008 21:57:00 -0200, ibloom <> escribió:
>
> > My main problem is, I don't know where to find the file:
> > File "<string>", line 628
>
> > As in I don't know what code it is refering to by <string> ??
> > It isn't code that I wrote, its something from python or pyObjC
>
> Mmm, didn't you get my previous post? The call is inside the py2app
> package. Quoting myself:
>
> >> <string>: inconsistent use of tabs and spaces in indentation
> >> Traceback (most recent call last):
> >> 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)
>
> > Put a print statement just above that line, to see which file triggers
> > the
> > error.
>
> In case it wasn't clear, modify the file
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packag es/py2app/py2app/util.py,
> around line 13, in the find_version function, adding this print statement:
>
> print 'about to compile', fn
> ast = compiler.parseFile(fn)
>
> The last line printed (in case there are many) should be the offending
> filename.
>
> Of course you don't have to keep the modified library, this is just to
> detect which file triggers the error. You should report this to the py2app
> developers as well.
>
> --
> Gabriel Genellina

Gabriel, your the master.
Of course I didn't understand that py2app was trying to compile my own
python source code and when I switched to Xcode as my new editor, I
started mixing in tabs. So <string> was in fact my code. All I had to
do was change my preferences in Xcode, to generate spaces instead of
tabs, remove all of the offending tabs and voila. You've ended days of
frustrations. Thank you.

Re: Difficulty with "inconsistent use of tabs and spaces in indentation"in file called <string>

ibloom wrote:
> Of course I didn't understand that py2app was trying to compile my own
> python source code and when I switched to Xcode as my new editor, I
> started mixing in tabs. So <string> was in fact my code.

Seems like py2app could be a bit friendlier about reporting
syntax errors in the code it's trying to compile!

Glad to be of any help. Note that all the clues were on the traceback.
When people here insist that all error reports should come with the
complete stack trace, it isn't because they want to be annoying, but
because it's really useful...

Glad to be of any help. Note that all the clues were on the traceback.
When people here insist that all error reports should come with the
complete stack trace, it isn't because they want to be annoying, but
because it's really useful...

Re: Difficulty with "inconsistent use of tabs and spaces inindentation" in file called <string>

En Wed, 13 Feb 2008 03:01:31 -0200, greg <>
escribiï¿½:
> ibloom wrote:
>> Of course I didn't understand that py2app was trying to compile my own
>> python source code and when I switched to Xcode as my new editor, I
>> started mixing in tabs. So <string> was in fact my code.
>
> Seems like py2app could be a bit friendlier about reporting
> syntax errors in the code it's trying to compile!

Yes, but the standard "compiler" package (used by py2app) is somewhat
guilty too. The parseFile function is called with a file name, but such
info is lost and the filename isn't used in the error messages. Compare
with the builtin "compile" function, which *does* use the supplied file
name to report meaningful errors.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!