Python path and append

Chris Angelico rosuav at gmail.com
Tue Apr 26 23:06:44 EDT 2016


On Wed, Apr 27, 2016 at 12:56 PM, Seymore4Head
<Seymore4Head at hotmail.invalid> wrote:
> On Tue, 26 Apr 2016 11:53:57 +1000, Steven D'Aprano
> <steve at pearwood.info> wrote:
>
>>On Tue, 26 Apr 2016 08:04 am, Seymore4Head wrote:
>>
>>> BTW I was trying to use a line like yours that used an output file
>>> that didn't exist and was getting an error.  I assume that import os
>>> fixes that.
>>
>>
>>Why would you assume that?
>>
>>
>>"Doctor, I have a problem with my arm, but I won't tell you what. I assume
>>that if I take cough drops that will fix it."
>
> OK.  Dumb question acknowledged.
>
> I got an error when I tried to write to a non existent file.  I
> "incorrectly" assumed wrong.  That is going to be a common theme.

If you can acknowledge that, I suggest adopting a stance that will
tend to avoid such assumptions in the future. The easiest way is to do
less of your own analysis and more copy/paste of exact error messages.
Don't say "getting an error" - quote the actual code and error. Don't
say "I assume that", ask the question ("Would importing the os module
fix that?"). We'll be able to help more easily with actual error text,
and you won't look dumb :)

ChrisA



More information about the Python-list mailing list