Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > plateform info.

Reply
Thread Tools

plateform info.

 
 
Monu Agrawal
Guest
Posts: n/a
 
      09-20-2005
Hi I want to know whether the program is being run on windows or on
Xnix. Is there any variable or method which tells me that it's windows?

 
Reply With Quote
 
 
 
 
Juho Schultz
Guest
Posts: n/a
 
      09-20-2005
Monu Agrawal wrote:
> Hi I want to know whether the program is being run on windows or on
> Xnix. Is there any variable or method which tells me that it's windows?
>


os.name - the value is "posix" for Linux/Unix, "nt" or "ce" for Windows,
and so on...
 
Reply With Quote
 
 
 
 
Mikael Olofsson
Guest
Posts: n/a
 
      09-20-2005
Monu Agrawal wrote:
> Hi I want to know whether the program is being run on windows or on
> Xnix. Is there any variable or method which tells me that it's windows?


Will this help?

>>> import sys
>>> sys.platform

'win32'

There is also the platform module, that can give you a lot more
information about the your platform. Try help(platform).

/MiO
 
Reply With Quote
 
Maurice LING
Guest
Posts: n/a
 
      09-22-2005
Mikael Olofsson wrote:
> Monu Agrawal wrote:
>
>> Hi I want to know whether the program is being run on windows or on
>> Xnix. Is there any variable or method which tells me that it's windows?

>
>
> Will this help?
>
> >>> import sys
> >>> sys.platform

> 'win32'
>
> There is also the platform module, that can give you a lot more
> information about the your platform. Try help(platform).
>
> /MiO


Adding onto this (which may be of need), but if this seems to be a
hijack, my apologies......

Is there a way of getting the path to the site-packages directory?
Considering that Mac OSX with Fink installs python libraries in
/sw/lib/python<version>, Mac OSX itself has python libraries in
/System/Library/Frameworks/Python.framework/Versions/<version>/lib, etc
etc...

maurice
 
Reply With Quote
 
Maurice LING
Guest
Posts: n/a
 
      09-22-2005
Mikael Olofsson wrote:

> Monu Agrawal wrote:
>
>> Hi I want to know whether the program is being run on windows or on
>> Xnix. Is there any variable or method which tells me that it's windows?

>
>
> Will this help?
>
> >>> import sys
> >>> sys.platform

> 'win32'
>
> There is also the platform module, that can give you a lot more
> information about the your platform. Try help(platform).
>
> /MiO


Adding onto this (which may be of need), but if this seems to be a
hijack, my apologies......

Is there a way of getting the path to the site-packages directory?
Considering that Mac OSX with Fink installs python libraries in
/sw/lib/python<version>, Mac OSX itself has python libraries in
/System/Library/Frameworks/Python.framework/Versions/<version>/lib, etc
etc...

maurice
 
Reply With Quote
 
Mike Meyer
Guest
Posts: n/a
 
      09-22-2005
Maurice LING <(E-Mail Removed)> writes:
> Is there a way of getting the path to the site-packages directory?


>>> import sys
>>> import os
>>> for dir in sys.path:

.... if os.path.split(dir)[-1] == 'site-packages':
.... print dir
....
/usr/opt/lib/python2.4/site-packages
>>>


But there's seldom a reason to want this.

> Considering that Mac OSX with Fink installs python libraries in
> /sw/lib/python<version>, Mac OSX itself has python libraries in
> /System/Library/Frameworks/Python.framework/Versions/<version>/lib, etc
> etc...


And darwinportgs puts them in
/Library/Frameworks/Python.framework/Versions/<Version>/lib/...
but includes /opt/local/lib/python2.4/site-packages in sys.path.

<mike
--
Mike Meyer <(E-Mail Removed)> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ in a windows plateform mokhta C++ 3 04-09-2007 12:17 PM
Corss plateform note programme - Where to Start? jonathanmcw@gmail.com C++ 1 05-06-2006 06:40 PM
Plateform Idependent kkm MCAD 1 09-16-2005 12:53 AM
Good java Installer ? ( cross-plateform + JNI ) P. Barthelemy Java 0 05-17-2005 06:25 AM



Advertisments