AttributeError: 'function' object has no attribute 'split'

Richard Brodie R.Brodie at rl.ac.uk
Thu May 6 12:57:06 EDT 2004


"Earl" <eee at nmt.edu> wrote in message news:11e5f362.0405060845.16fff0f8 at posting.google.com...
> PathList= string.split(FullPath, "/") is generating the above error
> message. when I run my script, but works just fine from the python
> command line!  What gives?

Somehow you've bound the name "string" to a function e.g.

>>> def string():
...  return 'help'
...
>>> string.split('1')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
AttributeError: 'function' object has no attribute 'split'

Let that be a lesson to you to never use meaningful variable names ;)





More information about the Python-list mailing list