os.name under Win32

Igor Kravtchenko igor at mekensleep.com
Fri Sep 1 15:13:09 EDT 2006


Hi Fredrik,

yes I've checked and I'm sure we don't assign os.name somewhere ourself.
I'll replace os.name == "posix" with sys.platform == "win32" as you
suggested and see how thing goes.

Thanks for your help,

Igor.


Fredrik Lundh wrote:

>Igor Kravtchenko wrote:
>
>  
>
>>We have an application using Python that is intended to work both under 
>>Win32 and Linux.
>>Since some parts of the code need to be different depending whether we 
>>are under Win32
>>or Linux, we use the traditional:
>>
>>if os.name == "posix":
>>  some Linux code
>>else:
>>  some Win32 code
>>    
>>
>
>the usual thing to test for is sys.platform, not os.name.
>
>    if sys.platform == "win32":
>        some win32 code (or win64 code)
>    else:
>        some linux code
>
>  
>
>>However, we have noticed that under some circumstances, in some cases, 
>>in some computers under Windows XP Family that the "posix" code was
>>    
>>
> > executed causing of course a crash.
>
>sounds weird.  have you checked your code so you don't assign to os.name 
>somewhere, by accident?
>
></F>
>
>  
>




More information about the Python-list mailing list