Is there an elegant way to dir() module from inside?
I am looking for a way to discover which classes a module contains from "inside". I am building a testing class that should, when instatntiated within any module, locate certain classes within the containing module. Words of wisdom? Anybody? -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there an elegant way to dir() module from inside?
Sion Arrowsmith wrote: > volcano <[EMAIL PROTECTED]> wrote: > >I am looking for a way to discover which classes a module contains from > >"inside". I am building a testing class that should, when instatntiated > >within any module, locate certain classes within the containing module. > > globals().keys() > > -- > \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ > ___ | "Frankly I have no feelings towards penguins one way or the other" > \X/ |-- Arthur C. Clarke >her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump thanks, it worked! -- http://mail.python.org/mailman/listinfo/python-list
Formatting device from a script on Windows
Hello, folks! Script I am creating has to format a device - USB flash drive. I have tried using regular DOS "format" through "os.system" - did not work well, because DOS format requires input from user. And the script should run without user interference. I have taken a look at ActivePython "win32..." libraries - did not find anything. Ideas? Pretty please? Regards, Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting device from a script on Windows
weir wrote: > this may help, you need ctypes module. > > ## > from ctypes import * > > fm = windll.LoadLibrary('fmifs.dll') > > def myFmtCallback(command, modifier, arg): > print command > return 1 # TRUE > > FMT_CB_FUNC = WINFUNCTYPE(c_int, c_int, c_int, c_void_p) > > > FMIFS_HARDDISK = 0x0C > fm.FormatEx(c_wchar_p('H:\\'), FMIFS_HARDDISK, c_wchar_p('NTFS'), > c_wchar_p('title'), True, c_int(0), FMT_CB_FUNC(myFmtCallback)) Thanks for info, but somehow I am getting "invalid syntax" on this. What could go wrong? -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting device from a script on Windows
OK, it worked. Obviosly, quick format was a bad choice. Thanks a lot for your help! Mark -- http://mail.python.org/mailman/listinfo/python-list
Running Python script from C++ code(.NET)
Hello, folks! A trivial question - I have a working Python script that I have to invoke from C++ code. No fancy stuff - just run the whole script with its parameters. No callbacks, no signalling - nada, just stupid,primitive, straightforward call. And while there is a lot of help on embedding, I could not find out how to run script as a whole.SOS -- http://mail.python.org/mailman/listinfo/python-list
Re: Running Python script from C++ code(.NET)
Gerard Flanagan wrote: > volcano wrote: > > Hello, folks! > > A trivial question - I have a working Python script that I have to > > invoke from C++ code. No fancy stuff - just run the whole script with > > its parameters. No callbacks, no signalling - nada, just > > stupid,primitive, straightforward call. > > > > And while there is a lot of help on embedding, I could not find out how > > to run script as a whole.SOS > > In C#: > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/da2a675da29b0bd/197b6a89095ef930?lnk=st&q=&rnum=4#197b6a89095ef930 > > hth > > Gerard Thanks for fast response, alas - it did not! My problem is - application in C++ used to use external application, which does not work well. So I sort of reproduced the functionality in Python script, but now I am stuck, unable to run it properly. -- http://mail.python.org/mailman/listinfo/python-list
Re: Running Python script from C++ code(.NET)
Gerard Flanagan wrote: > volcano wrote: > > Gerard Flanagan wrote: > > > volcano wrote: > > > > Hello, folks! > > > > A trivial question - I have a working Python script that I have to > > > > invoke from C++ code. No fancy stuff - just run the whole script with > > > > its parameters. No callbacks, no signalling - nada, just > > > > stupid,primitive, straightforward call. > > > > > > > > And while there is a lot of help on embedding, I could not find out how > > > > to run script as a whole.SOS > > > > > > In C#: > > > > > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/da2a675da29b0bd/197b6a89095ef930?lnk=st&q=&rnum=4#197b6a89095ef930 > > > > > > hth > > > > > > Gerard > > > > Thanks for fast response, alas - it did not! > > My problem is - application in C++ used to use external application, > > which does not work well. So I sort of reproduced the functionality in > > Python script, but now I am stuck, unable to run it properly. > > Maybe my understanding is wrong, but can't managed (.NET) C++ call into > any other managed assembly, in this case (I think) System.Diagnostics? > > Gerard My application is written in regular C++:( -- http://mail.python.org/mailman/listinfo/python-list
Re: Running Python script from C++ code(.NET)
volcano wrote: > Hello, folks! > A trivial question - I have a working Python script that I have to > invoke from C++ code. No fancy stuff - just run the whole script with > its parameters. No callbacks, no signalling - nada, just > stupid,primitive, straightforward call. > > And while there is a lot of help on embedding, I could not find out how > to run script as a whole.SOS Thanks a lot to all of you who cared to answer! Eventually it was "::CreateProcess", and it works! But here is another question for gurus: sometimes my script fails, and I cannot figure out why. OK, I can - especially since I terminate it with "sys.exit()", but I want my app to know too. "GetLastError" returns 0 - for the obvious reason that this is the value Python interpreter returns with. But how can I get the script return value? -- http://mail.python.org/mailman/listinfo/python-list
How to access an absolute address through Python?
Can it be done, and if yes - how? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to access an absolute address through Python?
On Feb 11, 2:21 pm, Maël Benjamin Mettler <[EMAIL PROTECTED]> wrote: > volcano schrieb: > > > Can it be done, and if yes - how? > > Define address. Are you talking about URLs? File paths? Postal > addresses? Memory addresses? Whatever addresses? > I'm afraid the people on this list can't read your thoughts... I presumed that "absolute" address somehow qualifies my question. If it is not - I was talking about physical computer memory, on PC - to be more specific. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to access an absolute address through Python?
On Feb 11, 2:46 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, volcano wrote: > > On Feb 11, 2:21 pm, Maël Benjamin Mettler <[EMAIL PROTECTED]> wrote: > >> volcano schrieb: > > >> > Can it be done, and if yes - how? > > >> Define address. Are you talking about URLs? File paths? Postal > >> addresses? Memory addresses? Whatever addresses? > >> I'm afraid the people on this list can't read your thoughts... > > > I presumed that "absolute" address somehow qualifies my question. If > > it is not - I was talking about physical computer memory, on PC - to > > be more specific. > > In pure Python it's not possible and even in C it might be difficult to > get an absolute *physical* memory address unless you run DOS. Modern > operating systems tend to use some virtualisation of memory. :-) > > What's your goal? What do you expect at the memory address you want to > access? > > Ciao, > Marc 'BlackJack' Rintsch My goal is to sync program with external equipment through a register defined as an absolute physical address. I know how to do it from C - was curious if it may be done from Python. Can it be done? Thanks, Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: How to access an absolute address through Python?
On Feb 11, 3:46 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > volcano wrote: > > On Feb 11, 2:46 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > [...] > >> What's your goal? What do you expect at the memory address you want to > >> access? > > >> Ciao, > >> Marc 'BlackJack' Rintsch > > > My goal is to sync program with external equipment through a register > > defined as an absolute physical address. I know how to do it from C - > > was curious if it may be done from Python. Can it be done? > > No. You'd have to use a compiled extension. > > regards > Steve > -- > Steve Holden +44 150 684 7255 +1 800 494 3119 > Holden Web LLC/Ltd http://www.holdenweb.com > Skype: holdenwebhttp://del.icio.us/steve.holden > Blog of Note: http://holdenweb.blogspot.com > See you at PyCon?http://us.pycon.org/TX2007 Steve, Fred, thank you. This is exactly what I have done, though I did hope for shortcut. Life is tough:)! -- http://mail.python.org/mailman/listinfo/python-list
How to couple pyunit with GUI?
I am desperately looking for an info how to combine a testing application with decent GUI interface - the way most xUnits do. I believe I have seen something about using Tkinter, but I do not remember - where. I am working on a complex testing application built over unittest module, and I need GUI interface that will alllow me to select tests at different levels of test hierarchy tree. I am new to python, so say everything slow and repeat it twice:) -- http://mail.python.org/mailman/listinfo/python-list
Re: How to couple pyunit with GUI?
Miki, toda, but it did not work for me. BTW, I have forgotten to mention - the implementation I develop should be multi-platform.If anything else comes to you mind - I'll be more than gateful to hear. Regards, Mark -- http://mail.python.org/mailman/listinfo/python-list
Getting return code for a Python script invoked from a Linux shell script
Hi, folks, I have a Python script that is invoked by a shell script. I uses sys.exit() with a parameter within python. The calling script is using this line to get the return code: exit_code = !$ but it fails to get it. What's wrong here? (I am no Linux guru) Thanks in advance Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting return code for a Python script invoked from a Linux shell script
On Sep 23, 8:01 pm, Donn wrote: > On Wednesday 23 September 2009 18:51:29 volcano wrote:> exit_code = !$ > > I think it's $? to get the code. > \d > -- > home:http://otherwise.relics.co.za/ > 2D vector animation :https://savannah.nongnu.org/projects/things/ > Font manager :https://savannah.nongnu.org/projects/fontypython/ Thanks to all who replied, actually, it was $! ( brain 'copy-paste' failure:) ) and $? did the job!!! -- http://mail.python.org/mailman/listinfo/python-list