Odd error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joshua.R.English@gmail.com

    #1

    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\li b\lib-tk\Tkinter.py", line 1403, in __call__
    return self.func(*args )
    File "C:\Python25\li b\idlelib\Multi Call.py", line 151, in handler
    r = l[i](event)
    File "C:\Python25\li b\idlelib\Scrip tBinding.py", line 151, in
    run_module_even t
    dirname = os.path.dirname (filename)
    File "C:\Python25\li b\ntpath.py", line 207, in dirname
    return split(p)[0]
    File "C:\Python25\li b\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?

  • John Machin

    #2
    Re: Odd error

    On Mar 17, 4:34 pm, "Joshua.R.Engl. ..@gmail.com"
    <Joshua.R.Engl. ..@gmail.comwro te:
    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\li b\lib-tk\Tkinter.py", line 1403, in __call__
    return self.func(*args )
    File "C:\Python25\li b\idlelib\Multi Call.py", line 151, in handler
    r = l[i](event)
    File "C:\Python25\li b\idlelib\Scrip tBinding.py", line 151, in
    run_module_even t
    dirname = os.path.dirname (filename)
    File "C:\Python25\li b\ntpath.py", line 207, in dirname
    return split(p)[0]
    File "C:\Python25\li b\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

    Comment

    • Joshua.R.English@gmail.com

      #3
      Re: Odd error

      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...@lexic on.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.>>i mport 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

      Comment

      • Terry Reedy

        #4
        Re: Odd error


        <Joshua.R.Engli sh@gmail.comwro te in message
        news:1174156377 .840487.302740@ l75g2000hse.goo glegroups.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



        Comment

        Working...