[New-bugs-announce] [issue7158] os.path.basename/split fails

Tom Kuiper report at bugs.python.org
Sat Oct 17 07:36:57 CEST 2009


New submission from Tom Kuiper <kuiper at jpl.nasa.gov>:

Normal behavior:
>>> from os import path
>>> filename 
= "/home/kuiper/Projects/microdischarges/Observing/2009-09-01/STATS_NP2000_VSR1A.1W1.09-244-193632"
>>> print filename
/home/kuiper/Projects/microdischarges/Observing/2009-09-01/STATS_NP2000_VSR1A.1W1.09-244-193632
>>> print path.basename(filename)
STATS_NP2000_VSR1A.1W1.09-244-193632

Abnormal behavior in class method:
from os import path
...
  def openDataFile(self):
    filename = QFileDialog.getOpenFileName(self, 'Open file','.')
    self.datafile.setTextpath.basename(filename))
...
Traceback (most recent call last):
  File "newWF.py", line 277, in openDataFile
    self.datafile.setText(os.path.basename(filename))
  File "/usr/lib/python2.5/posixpath.py", line 112, in basename
    return split(p)[1]
  File "/usr/lib/python2.5/posixpath.py", line 77, in split
    i = p.rfind('/') + 1
AttributeError: rfind

----------
files: newWF.py
messages: 94167
nosy: kuiper
severity: normal
status: open
title: os.path.basename/split fails
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file15153/newWF.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7158>
_______________________________________


More information about the New-bugs-announce mailing list