os.name under Win32

  • Thread starter Igor Kravtchenko
  • Start date
I

Igor Kravtchenko

Hi!

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

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.

My question is whether that is supposed to be totally impossible.
Under Win32, we are indeed supposed to have os.name = "nt". Is that value
hardcoded in Win32 binaries distribution themself? Can it potentially
change?

The purpose of this thread would be to have confirmed that under Win32,
os.name cannot never, ever be equal to "posix", whatever happens and so,
that we must have done some other mistakes elsewhere.

Thanks for any enlighting,

Igor.
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Igor said:
My question is whether that is supposed to be totally impossible.
Under Win32, we are indeed supposed to have os.name = "nt". Is that value
hardcoded in Win32 binaries distribution themself? Can it potentially
change?

I can't test it right now, but I would expect that Cygwin Python
binaries on Win32 have os.name == "posix".

Regards,
Martin
 
S

Steve Holden

Martin said:
I can't test it right now, but I would expect that Cygwin Python
binaries on Win32 have os.name == "posix".
That's correct.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top