[Tutor] If os.path.lexists() isn't working properly
Dave Angel
davea at ieee.org
Thu Nov 25 17:45:27 CET 2010
On 11/25/2010 09:20 AM, Susana Iraiis Delgado Rodriguez wrote:
> Hi Dave!
>
> Thank you for your suggestion I haven't prevent the problems you're
> describing, but I'm newbie in this stuff so, where should I repalce the
> code?
>
> Thank you again!
> 2010/11/24 Dave Angel<davea at ieee.org>
>
>> On 01/-10/-28163 02:59 PM, Susana Iraiis Delgado Rodriguez wrote:
>>
>>> <snip>
>>>
>>> wksht.row(row).write(1, filename)
>>> n = os.path.splitext(filename)
>>> p = ruta+'\\'+n[0]+'.prj'
>>>
>>>
>> Use os.path.join() to combine these nodes. If you use an explicit
>> backslash you can trigger two problems: 1) Your code won't be portable to
>> other platforms 2) You could have trouble if one of the components already
>> has a path separator.
>>
>>
>> DaveA
>>
>
May I request that you put your response at the end, or directly after
whatever you're responding to. What you did is called top-posting, and
while it's common in private email, it's bad practice in these forums.
It's also good to trim the parts that are no longer relevant, so the
messages don't get too huge. I'm guilty of omitting that step way too
often.
You have an example of os.path.join() in your own code, a few lines up.
But for this particular line, you could use
p = os.path.join(ruta, n[0], ".lprj")
HTH
DaveA
More information about the Tutor
mailing list