why this error?

Gary Herron gherron at islandtraining.com
Tue Mar 15 20:02:45 EST 2005


spencer wrote:

>Hi,
>I'm not sure why I can't concatenate dirname() with basename().
>  
>

Of course you *can* concatenate them, but you're not getting that far.  
The piece     

    os.path.dirname(os.getcwd)

should be

    os.path.dirname(os.getcwd())

Then it will work without raising an exception, but I'm not sure the 
result makes sense.

>Traceback (most recent call last):
>  File "showDir.py", line 50, in ?
>    print 'somthing new...', os.path.join(os.path.dirname(os.getcwd)) +
>os.path.basename(os.getcwd())
>  File "/usr/lib/python2.3/posixpath.py", line 119, in dirname
>    return split(p)[0]
>  File "/usr/lib/python2.3/posixpath.py", line 77, in split
>    i = p.rfind('/') + 1
>AttributeError: 'builtin_function_or_method' object has no attribute
>'rfind'
>Thanks,
>Wayne
>
>
>  
>




More information about the Python-list mailing list