473,378 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Odd error

I'm trying to use a script that I originally wrote on a Mac Classic
machine and have moved to a Windows XP machine.

I can open the script and edit the thing, but when I try to run it in
I get:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
return self.func(*args)
File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in handler
r = l[i](event)
File "C:\Python25\lib\idlelib\ScriptBinding.py", line 151, in
run_module_event
dirname = os.path.dirname(filename)
File "C:\Python25\lib\ntpath.py", line 207, in dirname
return split(p)[0]
File "C:\Python25\lib\ntpath.py", line 172, in split
while head2 and head2[-1] in '/\\':
TypeError: 'int' object is not iterable

I've converted the text to windows format, and the other scripts that
I transferred at the same time work.

What's going on here?

Mar 17 '07 #1
3 1287
On Mar 17, 4:34 pm, "Joshua.R.Engl...@gmail.com"
<Joshua.R.Engl...@gmail.comwrote:
I'm trying to use a script that I originally wrote on a Mac Classic
machine and have moved to a Windows XP machine.

I can open the script and edit the thing, but when I try to run it in
I get:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
return self.func(*args)
File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in handler
r = l[i](event)
File "C:\Python25\lib\idlelib\ScriptBinding.py", line 151, in
run_module_event
dirname = os.path.dirname(filename)
File "C:\Python25\lib\ntpath.py", line 207, in dirname
return split(p)[0]
File "C:\Python25\lib\ntpath.py", line 172, in split
while head2 and head2[-1] in '/\\':
TypeError: 'int' object is not iterable

I've converted the text to windows format, and the other scripts that
I transferred at the same time work.

What's going on here?
The following demonstrate the correct behaviour of ntpath.split():

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>import ntpath
ntpath.split('foo\\\\')
('foo', '')
>>ntpath.split('foo\\\\bar\\\\')
('foo\\\\bar', '')
>>ntpath.split('foo\\\\bar')
('foo', 'bar')
>>ntpath.split('foo\\bar')
('foo', 'bar')
>>ntpath.split('\\\\bar')
('\\\\', 'bar')

I can't see how this error could arise from the line:
while head2 and head2[-1] in '/\\':
The only possible iterable is the constant '/\\' ...

You may have a corrupt Python 2.5 installation; try the above tests;
if one fails, delete any ntpath.pyc and/or ntpath.pyo and try again.

I'm suspicious of the 'lib' directory name; standard Python
installations on Windows call the directory 'Lib' AFAIK; how did you
install Python?

HTH,
John

Mar 17 '07 #2
I installed it using the regular download form python.org. I went
back and did a lot of testing with the file, commenting out most of
it, seeing what would actually run, and it seems I had a normal
semantic error:

self.data(one).append(item)

and data is in fact a dictionary, not a callable object. What gets me
is the massive red herring this error is. I wasn't doing anything
with ntpath in the script. The script selectively extracts
information from an XML file, that's all.

Thanks,

Josh

On Mar 17, 2:30 am, "John Machin" <sjmac...@lexicon.netwrote:
>
The following demonstrate the correct behaviour of ntpath.split():

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.>>import ntpath
>ntpath.split('foo\\\\')
('foo', '')
>ntpath.split('foo\\\\bar\\\\')
('foo\\\\bar', '')
>ntpath.split('foo\\\\bar')
('foo', 'bar')
>ntpath.split('foo\\bar')
('foo', 'bar')
>ntpath.split('\\\\bar')

('\\\\', 'bar')

I can't see how this error could arise from the line:
while head2 and head2[-1] in '/\\':
The only possible iterable is the constant '/\\' ...

You may have a corrupt Python 2.5 installation; try the above tests;
if one fails, delete any ntpath.pyc and/or ntpath.pyo and try again.

I'm suspicious of the 'lib' directory name; standard Python
installations on Windows call the directory 'Lib' AFAIK; how did you
install Python?

HTH,
John

Mar 17 '07 #3

<Jo**************@gmail.comwrote in message
news:11**********************@l75g2000hse.googlegr oups.com...
|I installed it using the regular download form python.org. I went
| back and did a lot of testing with the file, commenting out most of
| it, seeing what would actually run, and it seems I had a normal
| semantic error:
|
| self.data(one).append(item)
|
| and data is in fact a dictionary, not a callable object. What gets me
| is the massive red herring this error is. I wasn't doing anything
| with ntpath in the script. The script selectively extracts
| information from an XML file, that's all.

When you run a script from IDLE, it saves it to disk, and in the process of
saving, IDLE looks at the path. I don't think your script ever ran. At
least that is what I gathered from the traceback. I agree with JM: the
traceback and error message do not match, so this is indeed an 'odd' error.

Terry Jan Reedy

Mar 17 '07 #4

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
1
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
0
by: mchuc7719 | last post by:
Hello, I have a Vb.Net 2005 ClassLibrary, when I try to compile using MSBee, only get errors. Before I to run the command line, I open in notepad the .vbproj and I was add the next line: ...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.