This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年02月28日 03:13 by glittershark, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (7) | |||
|---|---|---|---|
| msg154529 - (view) | Author: Griffin Smith (glittershark) | Date: 2012年02月28日 03:13 | |
This occurs even when calling methods in modules (such as os.path.splitext), so I know it's not happening due to an error on my part Win7 SP1 |
|||
| msg154530 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年02月28日 03:41 | |
You'll have to give more details about what you are doing, but I suspect you are in fact calling it incorrectly. In addition, there are pretty much no circumstances in which you want to use string.rfind in 2.7. Just use ''.rfind. |
|||
| msg154531 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年02月28日 03:50 | |
Ah, perhaps you *meant* you are calling rfind on a string, rather than calling rfind on the 'string' module as I imagined.
So, we definitely need more details about how you are producing this failure and what the traceback looks like. 'abc'.rfind('a') works fine for me, and works fine on Windows in our unit tests.
|
|||
| msg154532 - (view) | Author: Griffin Smith (glittershark) | Date: 2012年02月28日 03:57 | |
Sorry about the lack of clarity there.
I'm calling os.path.splitext("C:\blah.ext") and trackback is returning an AttributeError: 'list' object has no attribute 'rfind' from within the definition for splitext in the NTPath module.
That's only the specific usage that brought about the error - I'm getting it for all calls to rfind everywhere.
I will admit it's a very strange error - I did some searching around and nobody else is experiencing the bug, so clearly it's a problem with my particular installation of Python. I haven't used any third-party Python extensions, however, and everything seems like it's as vanilla as possible to me.
|
|||
| msg154541 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2012年02月28日 09:21 | |
I can't reproduce this. Can you please post the entire traceback? It would be preferable if you could also show the exact code that's causing the problem, typed from a python command prompt (see my example below). I can reproduce the error if I pass a list to ps.path.splitext(), which is what I suspect you're doing: >>> os.path.splitext(['c:\\blah.ext']) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/posixpath.py", line 95, in splitext return genericpath._splitext(p, sep, altsep, extsep) File "/usr/lib/python2.6/genericpath.py", line 91, in _splitext sepIndex = p.rfind(sep) AttributeError: 'list' object has no attribute 'rfind' And you probably want: os.path.splitext("C:\\blah.ext"), so as to escape the backslash. |
|||
| msg154568 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2012年02月28日 19:45 | |
I'm going to close this. Feel free to re-open it if you can give a small example showing the problem. |
|||
| msg154569 - (view) | Author: Griffin Smith (glittershark) | Date: 2012年02月28日 19:48 | |
Actually, I did some diagnosis and it would appear it was actually an inappropriate call - I was assuming os.path.walk returned a tuple containing a list of files instead of a tuple containing a list of lists of files. Sorry about that. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:27 | admin | set | github: 58353 |
| 2012年02月28日 20:02:51 | ezio.melotti | set | stage: resolved |
| 2012年02月28日 19:48:33 | glittershark | set | messages: + msg154569 |
| 2012年02月28日 19:45:36 | eric.smith | set | status: open -> closed type: crash -> behavior resolution: not a bug messages: + msg154568 |
| 2012年02月28日 09:21:04 | eric.smith | set | nosy:
+ eric.smith messages: + msg154541 |
| 2012年02月28日 03:57:39 | glittershark | set | messages: + msg154532 |
| 2012年02月28日 03:50:59 | r.david.murray | set | messages: + msg154531 |
| 2012年02月28日 03:41:17 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg154530 |
| 2012年02月28日 03:13:02 | glittershark | create | |