How to get the filename in the right case ?
stef.mientki at gmail.com
Thu Sep 25 16:43:53 CEST 2008
Diez B. Roggisch wrote:
>> Yes I'm pretty sure, two reasons:
>> 1. when I perform a step_into, jumping into a file that doesn't have
>> breakpoints itself (meaning my program doesn't even know of this file),
>> pdb returns a lowercase filename
> What has that to do with potential output postprocessing?
>> 2. rpdb2 (probably based or even inherited from pdb) has the same
>> behavior. Asking the writer of rpdb2, I got some excuse (which I didn't
>> understand) why he had done it that way.
> rpdb2 is not pdb.
> Below is the output of a Pdb-session I just had:
> (eggbasket)dir at client8049:~/software/vc/EggBasket$ nosetests -s
> 2008-09-25 14:13:10,374 turbogears.identity.saprovider INFO Loading:
> .> /home/dir/software/vc/EggBasket/eggbasket/tests/test_model.py(59)test_versionsets()
> -> vi1 = vset.add_pkg_info(p1)
> (Pdb) n
> -> session.flush()
> (Pdb) n
> As you can see - mixed-case filenames. Linux though.
> There is a *very* simple way for you to check: just create a file called
> and inside that, put
> import pdb; pdb.set_trace()
> print "hello"
> Run that on the windows shell. See if that puts out all lowercase or not. I
> can't do that right now as my VBox Windows won't start.
>>> import Module1
-> print "hello"
> Then we know if PDB is really the culprit.
So pdb is the problem.
> Apart from that, is that really a problem that the filenames are all lower
> case? AFAIK Windows is case-insensitive regarding filenames anyway. So
> opening the file by just passing the filename should work seamless.
Yes windows is,
but Python is not.
My program should run on Windows and Linux (and maybe a few others).
By converting everything to lowercase, on Linux I can't distinguishes
between 2 files with the same name but a different case
(btw, giving 2 files the same name, only differing in case, looks like a
bad idea to me).
And yes I could switch to lowercase in case I'm on a windows machine,
but my program is too beautiful to pollute the code with these kind of
unnecessary statements ;-)
More information about the Python-list