473,772 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difficulty with "inconsiste nt use of tabs and spaces in indentation"in file called <string>

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_o ptions)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/core.py", line 149, in setup
dist.run_comman ds()
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/dist.py", line 946, in run_commands
self.run_comman d(cmd)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/dist.py", line 966, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 342, in run
self.initialize _plist()
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 415, in
initialize_plis t
plist = self.get_defaul t_plist()
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 294, in
get_default_pli st
version = find_version(ta rget.script)
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
ast = compiler.parseF ile(fn)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/compiler/transformer.py" , line 48, in parseFile
return parse(src)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/compiler/transformer.py" , line 52, in parse
return Transformer().p arsesuite(buf)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/compiler/transformer.py" , line 129, in parsesuite
return self.transform( parser.suite(te xt))
File "<string>", line 628
else:
^
SyntaxError: invalid syntax

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

Any thoughts.
Ian Bloom
Feb 11 '08 #1
12 7557
En Mon, 11 Feb 2008 13:34:17 -0200, ibloom <ia*******@gmai l.comescribi� :
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_o ptions)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/core.py", line 149, in setup
dist.run_comman ds()
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/dist.py", line 946, in run_commands
self.run_comman d(cmd)
File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/dist.py", line 966, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 342, in run
self.initialize _plist()
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 415, in
initialize_plis t
plist = self.get_defaul t_plist()
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 294, in
get_default_pli st
version = find_version(ta rget.script)
File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
ast = compiler.parseF ile(fn)
Put a print statement just above that line, to see which file triggers the
error.

--
Gabriel Genellina

Feb 11 '08 #2
On Feb 11, 9:34*am, ibloom <ianmbl...@gmai l.comwrote:
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_o ptions)
* File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/core.py", line 149, in setup
* * dist.run_comman ds()
* File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/dist.py", line 946, in run_commands
* * self.run_comman d(cmd)
* File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/distutils/dist.py", line 966, in run_command
* * cmd_obj.run()
* File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 342, in run
* * self.initialize _plist()
* File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 415, in
initialize_plis t
* * plist = self.get_defaul t_plist()
* File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/build_app.py", line 294, in
get_default_pli st
* * version = find_version(ta rget.script)
* File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
* * ast = compiler.parseF ile(fn)
* File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/compiler/transformer.py" , line 48, in parseFile
* * return parse(src)
* File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/compiler/transformer.py" , line 52, in parse
* * return Transformer().p arsesuite(buf)
* File "/Library/Frameworks/Python.framewor k/Versions/2.4//lib/
python2.4/compiler/transformer.py" , line 129, in parsesuite
* * return self.transform( parser.suite(te xt))
* File "<string>", line 628
* * else:
* * ^
SyntaxError: invalid syntax

I don't even know which file has the indentation problem.
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
Feb 11 '08 #3
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

Ian Bloom
Feb 12 '08 #4
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>
ZeroDivisionErr or: 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>
ZeroDivisionErr or: integer division or modulo by zero
>>>
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Feb 12 '08 #5
En Mon, 11 Feb 2008 21:57:00 -0200, ibloom <ia*******@gmai l.comescribió:
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.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
ast = compiler.parseF ile(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.framewor k/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.parseF ile(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

Feb 12 '08 #6
On Feb 11, 9:10*pm, "Gabriel Genellina" <gagsl-...@yahoo.com.a r>
wrote:
En Mon, 11 Feb 2008 21:57:00 -0200, ibloom <ianmbl...@gmai l.comescribió:
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.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
* * ast = compiler.parseF ile(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.framewor k/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.parseF ile(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
You are right, I didn't understand. I'll try it. Thank you.

Ian Bloom
Feb 12 '08 #7
On Feb 11, 9:10*pm, "Gabriel Genellina" <gagsl-...@yahoo.com.a r>
wrote:
En Mon, 11 Feb 2008 21:57:00 -0200, ibloom <ianmbl...@gmai l.comescribió:
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.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
* * ast = compiler.parseF ile(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.framewor k/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.parseF ile(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 <stringwas 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.

Ian Bloom
Feb 13 '08 #8
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 <stringwas in fact my code.
Seems like py2app could be a bit friendlier about reporting
syntax errors in the code it's trying to compile!

--
Greg
Feb 13 '08 #9
En Tue, 12 Feb 2008 22:57:01 -0200, ibloom <ia*******@gmai l.comescribi� :
On Feb 11, 9:10Â*pm, "Gabriel Genellina" <gagsl-...@yahoo.com.a r>
wrote:
>>
><string>: inconsistent use of tabs and spaces in indentation
Traceback (most recent call last):
Â* File "/Library/Frameworks/Python.framewor k/Versions/2.4/lib/
python2.4/site-packages/py2app/py2app/util.py", line 13, in
find_version
Â* Â* ast = compiler.parseF ile(fn)
Put a print statement just above that line, to see which file >
triggers the error.

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 <stringwas 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.
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...

--
Gabriel Genellina

Feb 13 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7600
by: vijay | last post by:
Hello, As the subject suggests, I need to print the string in the reverse order. I made the following program: # include<stdio.h> struct llnode { char *info;
0
1405
by: Kyle Blaney | last post by:
Is there a way to control how the "Edit->Advanced->Format Selection" command formats long lines? In particular, I want the command to indent long lines differently than new scope. By default, the command indents each in exactly the same way. For example, if I have my indentation level set to 3 spaces, I want code formatted as follows: if (a != b) {
1
2291
by: Charlie | last post by:
Hi: Is it possible to apply formatting to above statements which insert field values into HTML when binding to a datasource using Repeater control? For example, I would like to trim trailing spaces. Also, I have tried things like this, but can't get them to work: <%# DataBinder.Eval(Container.DataItem, "lname") + ((DataBinder.Eval(Container.DataItem, "some_field")=="")?"":", ") + DataBinder.Eval(Container.DataItem, "fname")%>
3
1984
by: MLH | last post by:
If I run ?", ","" in the immediate window, I get a comma followed by 13 spaces. It is difficult for me to understand this.
4
2005
by: Robert Bravery | last post by:
HI all, I have imported string data that contains numerical values. The negatives are reporesented in round braces () as in (192) representing -192. How can I convert thin string into a negative number while converting other numbers as positive numerical data Thanks Robert
2
3919
by: keithtracypierce | last post by:
1)Access2003, beating my head against the wall, every other iteration is "can't find macro Upshift" followed by carefully verifying that no blank properties have been entered. Making NO changes at all, sometimes the message goes away, sometimes not. Any clues? 2)The other headbeating iterations are due to no joy when trying to allow T,F,Blank in a 1-character field, with AutoTab enabled. InputMask:>C;; DefaultValue:
6
2765
by: Sile | last post by:
Hello, I'm trying to get f2py working from the command line on windows XP. I have mingw32 as my C complier (after some advice on a previous thread) and Compaq Visual Fortran 6.5. Changing my C complier reduced my errors but I'm still having trouble. I think I have all the correct paths set but I'm not sure. F2PY gets further when I specifically tell it what my compilers are as follows................. C:\Program...
19
2880
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - I have <a href="javascript:somefunction()"what ... ? ----------------------------------------------------------------------- Whatever the rest of your question, this is generally a very bad use of the javascript pseudo protocol. It was designed so that a function could return a new page. For example: `` javascript:"<p>Hello</p>" ''. Using it simply to...
1
1551
by: craigslist.jg | last post by:
Basically, I want to do this in Javascript: I want to convert a string such as: Cities New York Address 1 Address 2 Address 3
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.