[Tutor] command to determine of python 32 or 64 bit?

2016-08-10 Thread Garry Willgoose
I have a number of binary libraries that are dependent on whether the 
precompiled python distribution (eg. Enthought, ActiveState, etc)  in which 
they are installed are compiled with 32 or 64 bit. Is there any reliable way to 
determine at run time whether a python distribution is 32 or 64 bit? If I can 
determine at runtime then I can set the path for loading of my libraries to 
something different depending on whether the python is 32 or 64 bit.






___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Problem with graphics.py

2016-08-10 Thread Alan Gauld via Tutor
On 09/08/16 17:55, Michael Selik wrote:

> Do you mind running the following commands from the python shell?
> 
> py> import os
> py> os.getcwd()
> '/Users/mike'
> py> sorted(os.listdir('.'))
> ['.Trash', 'Applications', 'Desktop', ...]
> 
> This will show us what location your python interpreter has as the "current
> working directory" and whether or not the "graphics.py" file is present in
> that directory.

That's true but only one of the locations that Python looks in.
You also need to use the command Steven suggested:

>>> import sys
>>> sys.path

to see all the places Python will look.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] command to determine of python 32 or 64 bit?

2016-08-10 Thread eryk sun
On Wed, Aug 10, 2016 at 4:27 AM, Garry Willgoose
 wrote:
> I have a number of binary libraries that are dependent on whether the 
> precompiled python
> distribution (eg. Enthought, ActiveState, etc)  in which they are installed 
> are compiled with
> 32 or 64 bit. Is there any reliable way to determine at run time whether a 
> python distribution
> is 32 or 64 bit? If I can determine at runtime then I can set the path for 
> loading of my libraries
> to something different depending on whether the python is 32 or 64 bit.

Use platform.architecture()[0]. Currently the value will be either
"32bit" or "64bit".
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] command to determine of python 32 or 64 bit?

2016-08-10 Thread Alan Gauld via Tutor
On 10/08/16 11:41, eryk sun wrote:

>> 32 or 64 bit. Is there any reliable way to determine at run time whether a 
>> python distribution
>> is 32 or 64 bit? 
> 
> Use platform.architecture()[0]. Currently the value will be either
> "32bit" or "64bit".

I assumed that was sys.platform?

But on my Linux box I only get the string 'linux'
for platform...
So is the architecture bit windows only? Or is it
a different 'platform'?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] command to determine of python 32 or 64 bit?

2016-08-10 Thread Alan Gauld via Tutor
On 10/08/16 11:41, eryk sun wrote:

> Use platform.architecture()[0]. Currently the value will be either
> "32bit" or "64bit".

Its OK, I just discovered there is a platform module!
New one on me. That works :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor