idiom to ask if you are on 32 or 64 bit linux platform?

J

Jon

Hello everyone,

I've got a ctypes wrapper to some code which seems to be different
when compiled on 32 bit linux compared to 64 bit linux. For the
windows version I can use sys.platform == 'win32' versus 'linux2' to
decide whether to get the .dll or .so library to load. Having narrowed
it down to linux I still need to choose between libKLT32.so and
libKLT64.so

Can someone tell me an idiom to choose the right one?

Thanks!

Jon
 
M

Matt Nordhoff

Jon said:
Hello everyone,

I've got a ctypes wrapper to some code which seems to be different
when compiled on 32 bit linux compared to 64 bit linux. For the
windows version I can use sys.platform == 'win32' versus 'linux2' to
decide whether to get the .dll or .so library to load. Having narrowed
it down to linux I still need to choose between libKLT32.so and
libKLT64.so

Can someone tell me an idiom to choose the right one?

Thanks!

Jon

What about the platform module? platform.architecture() should do it.

<http://docs.python.org/lib/module-platform.html>

('32bit', '')

Note that it analyzes an executable (defaulting to the python
interpreter binary), rather than looking in /proc or something. You
might want to do something like that instead. I guess looking at the
python binary is more accurate on a hybrid 32-bit/64-bit system though..
--
 

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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top