Module calling-newbie question

Peter Otten __peter__ at web.de
Fri May 28 12:05:37 EDT 2004


Roland Hedberg wrote:

> Hi!
> 
> I'm having problems with using modules. I'lls start with the error as it
> is presented:
> 
> Exception in Tree control callback
> Traceback (most recent call last):
>    File "/local/develop/apacheadmin/Tree.py", line 427, in PVT_set_state
>      self.widget.get_contents_callback(self)
>    File "sexptree.py", line 11, in getelements
>      for element in spo.sublist(node):
>    File "/local/develop/apacheadmin/sexp.py", line 103, in sublist
>      ss = string.split( subspec, "/" )
>    File "/usr/local/lib/python2.3/string.py", line 121, in split
>      return s.split(sep, maxsplit)
> 
> I using the tkinter based Tree.py module Charles E. "Gene" Cash and have
> built one module sexp.py which among other things tries to split a
> string. Really nothing fancy but it fails when the sexp module is used
> by a python program sexptree.py (also by me).
> 
> Sexp.py as well as sexptree.py imports string.
> 
> What more can I do ??
> What am I doing wrong ??

You could throw in a

print repr(subspec)

statement above

ss = string.split(subspec, "/") # ss = subspec.split("/") in current Python

to verify that subspec is really a string.

Peter




More information about the Python-list mailing list