[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? I

[Tutor] command line list arguments

2015-11-07 Thread Garry Willgoose
I want to input a python list as a command line argument as for example python weathering-sens.py -daughter ['p0-50-50','p0-0-0-100’] but what I get from sys.argv is [p0-50-50,p0-0-0-100] without the string delimiters on the list elements. I’m probably missing something really simple because sy

Re: [Tutor] making a shortcut in windows

2012-09-04 Thread Garry Willgoose
gt; On 4 September 2012 02:57, Garry Willgoose > wrote: > I want to put a shortcut onto the desktop in windows (XP and later) in Python > 2.6 or later. In Unix its easy using os.symlink but I can't find anything > equivalent for windows. My searches on the web led me to the code belo

[Tutor] making a shortcut in windows

2012-09-03 Thread Garry Willgoose
I want to put a shortcut onto the desktop in windows (XP and later) in Python 2.6 or later. In Unix its easy using os.symlink but I can't find anything equivalent for windows. My searches on the web led me to the code below but the code returns the error AttributeError: function 'CreateSymbolic

[Tutor] shutil.rmtree clarification

2012-05-17 Thread Garry Willgoose
and. What do people suggest short of calling os.system('rm -R test_directory'). - Prof Garry Willgoose Australian Professorial Fellow, School of Engineering, The University of Newcastle, Callaghan, NSW, 2308. Australia Phone: +61 2 4921 60

[Tutor] shutil.rmtree clarification

2012-05-17 Thread Garry Willgoose
and. What do people suggest short of calling os.system('rm -R test_directory'). - Prof Garry Willgoose Australian Professorial Fellow, School of Engineering, The University of Newcastle, Callaghan, NSW, 2308. Australia Phone: +61 2 4921 60

[Tutor] shutil.rmtree clarification

2012-05-17 Thread Garry Willgoose
and. What do people suggest short of calling os.system('rm -R test_directory'). - Prof Garry Willgoose Australian Professorial Fellow, School of Engineering, The University of Newcastle, Callaghan, NSW, 2308. Australia Phone: +61 2 4921 60

Re: [Tutor] bogus characters in a windows file

2012-02-09 Thread Garry Willgoose
for each simulation with os.system() and occasionally a simulation goes into an infinite loop, which stalls the monte-carlo so we just want to be able to kill that simulation and go to the next one. WE do this sort of stuff on *NIX all the time using the unix command 'ps' but because

[Tutor] bogus characters in a windows file

2012-02-08 Thread Garry Willgoose
I'm reading a file output by the system utility WMIC in windows (so I can track CPU usage by process ID) and the text file WMIC outputs seems to have extra characters in I've not seen before. I use os.system('WMIC /OUTPUT:c:\cpu.txt PROCESS GET ProcessId') to output the file and parse file c:\c

[Tutor] OS dependence of line separators

2011-01-31 Thread Garry Willgoose
n when opening the new file ... which, ughh, requires me to explicitly convert all numbers to strings before I write them. Prof Garry Willgoose, email: garry.willgo...@newcastle.edu.au; g.willgo...@telluricresearch.com email-for-life: garry.willgo...@alum.mit.edu personal webpage: www.tellu

[Tutor] querying the name of a calling python file

2010-11-05 Thread Garry Willgoose
e I've been able to run a broader cross-section of my codes. ==== Prof Garry Willgoose, Australian Professorial Fellow in Environmental Engineering, Director, Centre for Climate Impact Management (C2IM), School of Engineering, The University of Newcastle, Callaghan, 2308 Australia. Centre

[Tutor] portability of pickle and shelve across platforms and different python versions?

2010-05-05 Thread Garry Willgoose
7;) all should be well for platform independence. My core question if I give a pickled file to somebody else can i guarantee they can read/load it OK. The other person will be using exactly the same python code to open it as used to create it. ======

[Tutor] sys.path and the path order

2010-04-22 Thread Garry Willgoose
My question is so simple I'm surprised I can't find an answer somewhere. I'm interested if I can rely on the order of the directories in the sys.path list. When I'm running a file from the comand line like python tellusim.py The string in entry sys.path[0] appears to be the full path to th

[Tutor] aliasing an imported module

2010-02-12 Thread Garry Willgoose
erent variables in entirely different modules. IS there any way to do this? Prof Garry Willgoose, Australian Professorial Fellow in Environmental Engineering, Director, Centre for Climate Impact Management (C2IM), Scho

[Tutor] why is os.path.walk so slow?

2009-11-04 Thread Garry Willgoose
n do that better utilizes my broadband bandwidth? ==== Prof Garry Willgoose, Australian Professorial Fellow in Environmental Engineering, Director, Centre for Climate Impact Management (C2IM), School of Engineering, The University of Newcastle, Callaghan, 2308 Australia. Centre we

[Tutor] wxPython dialog problem

2009-02-19 Thread Garry Willgoose
I'm just porting an old code from a GUI in Tkinter to one in wxPython and am having a problem with one of the dialog widgets. This is on OSX. The code below gives the result result= 5104 5103 5104 as expected but if I substitute the single line form that is commented out (as per the wxPyth

Re: [Tutor] capturing exceptions from an exec statement

2008-04-08 Thread Garry Willgoose
gt;> raised an exception that I could capture. I seem unable to get this >> to throw an exception no matter what is in commandtext. I assume I'm >> missing something simple here. >> >> Alternatively should I open a process with popen ... I want to be >> able to

[Tutor] capturing exceptions from an exec statement

2008-04-08 Thread Garry Willgoose
sting scope and the way I read popen I can't do that. ==== Prof Garry Willgoose, Australian Professorial Fellow in Environmental Engineering, Director, Centre for Climate Impact Management (C2IM), School of Engineering, The Univ

[Tutor] creating a nested dictionary

2008-01-24 Thread Garry Willgoose
is is a pretty common construct in what I'm doing so I'm just wondering if there is a clear and simple shortcut ;-) ======== Prof Garry Willgoose, Australian Professorial Fellow in Environmental Engineering, Director,

[Tutor] providing a Python command line within a Tkinter appl

2008-01-01 Thread Garry Willgoose
... just like in the Python interpreter or IDLE". ======== Prof Garry Willgoose, Australian Professorial Fellow in Environmental Engineering, Director, Centre for Climate Impact Management (C2IM), School of Engineering, The University o

Re: [Tutor] import and reload in modules

2007-11-04 Thread Garry Willgoose
ria900) Traceback (most recent call last): File "", line 1, in File "mytest1.py", line 10, in load exec(text2) File "", line 1, in NameError: name 'siberia900' is not defined - ==

[Tutor] import and reload in modules

2007-11-04 Thread Garry Willgoose
>>> mytest.load() here 10 import siberia900 '1.00' >>> mytest.load() here 3 import siberia900 '1.00' >>> reload(mytest) >>> mytest.load() here 10 import siberia900 '1.00' - =