Re: Working example for calling a specific form from a python script

"Adrian Maier" <[email protected]> Mon, 20 Nov 2006 12:50:24 +0200
Newsgroups gmane.comp.gnu.enterprise.general
Message-ID <[email protected]>
On 11/20/06, Adrian Maier <[email protected]> wrote:
> On 11/17/06, Jan Ischebeck <[email protected]> wrote:
> > Hi Adrian,
> >
> > to remove the annoying  text mode  user/password questions you can use
> > the SilentLoginHandler.
> >
> > Add to imports:
> > from gnue.common.datasources.GLoginHandler import SilentLoginHandler
> >
> > Add to constructor:
> > loginHandler = SilentLoginHandler (_username = user, _password = paswd)
> > self.connections.setLoginHandler (loginHandler)
>
> Thanks Jan!   The script is running flawlessly now.
>
> Now I am taking the new step : run the script from an embedded python
> interpreter (dynamically linked with a pascal program).  Apparently,  there
> are differences when embedding python compared to running the python
> executable :
>
> Traceback (most recent call last):
>   File "<string>", line 1, in ?
>   File "/usr/local/gnue/lib/python/gnue/__init__.py", line 31, in ?
>     import gnue.common.apps as _init
>   File "/usr/local/gnue/lib/python/gnue/common/apps/__init__.py", line 30, in ?
>     import GDebug
>   File "/usr/local/gnue/lib/python/gnue/common/apps/GDebug.py", line 34, in ?
>     if '--debug-imports' in sys.argv or os.environ.has_key('GNUE_DEBUG_IMPORT'):
> AttributeError: 'module' object has no attribute 'argv'

The problem disappeard after setting the argv to a dummy list :

import sys
sys.argv=[""]


-- 
Adrian Maier