catch argc-argv
John Machin
sjmachin at lexicon.net
Mon Jun 20 04:54:59 EDT 2005
mg wrote:
> Hello,
>
> I am writting bindings for a FEM application. In one of my function
> 'initModulename', called when the module is imported, I would like to
> get the argc and argv arguments used in the main function of Python.
This is an "interesting" way of writing bindings. Most people would
provide an interface in terms of either a library of functions or a
class or two. I don't recall ever seeing a module or package that did
what you say you want to do.
Consider that your module should NOT be tied to command-line arguments.
Abstract out what are the essential inputs to whatever a "FEM
application" is. Then the caller of your module can parse those inputs
off the command line using e.g. optparse and/or can collect them via a
GUI and/or hard code them in a test module and/or read them from a test
data file or database.
> So, my question is: does the Python API containe fonctions like
> 'get_argc()' and 'get_argv()' ?
>
If you can't see them in the documentation, they aren't there. If they
aren't there, that's probably for a good reason -- no demand, no use case.
More information about the Python-list
mailing list