Retrieve ext. variables in python program
Trying to convert TCL code to python. Have a property file from where I read some VAR's. Looks like this: EARPROJECT = sgs-procDist APPNAME = SGSProcedure In my TCL code I confirm the existence of the VAR = f.ex EARPROJECT by using code: if { ([info exists APPNAME] && [info exists STAGEDIR] && [info exists EARPROJECT] && [info exists EARDESTINATION]) } { Does anyone know and equalent way to confirm a Variable from the same property file using PYTHON code ??? -- http://mail.python.org/mailman/listinfo/python-list
Re: Retrieve ext. variables in python program
[EMAIL PROTECTED] skrev: > alfa1234: > > Does anyone know and equalent way to confirm a Variable from the same > > property file using PYTHON code ??? > > Using globals(), locals(), and dir() you can find if your name exists > already. > > Bye, > bearophile Hi bearophile !! Thanks for the answer..Tried to use these methods, but with no luck. What needed is a way for my code to look at the external property file with the lines: >>earProject = sgs-procDist >>Appname = SGSProcedure and accept "earProject" and "Appname" as a Variable if they exist... Can Y help here..?? Rgds alfa1234 -- http://mail.python.org/mailman/listinfo/python-list
Re: Retrieve ext. variables in python program
Hi Diez !! Thanks for the reply.. Tried a little well dokumented program: # file: construct.ini retries = 10 # file: construct.py import cfgparse c = cfgparse.ConfigParser() c.add_option('retries', type='int') c.add_file('construct.ini') opts = c.parse() print 'Number of retries:',opts.retries Got the following Error when trying to run code: [wsadmin] Traceback (innermost last): [wsadmin] File "", line 1, in ? [wsadmin] ImportError: no module named cfgparse -- http://mail.python.org/mailman/listinfo/python-list
Re: Retrieve ext. variables in python program
Diez B. Roggisch skrev: > alfa1234 wrote: > > > Trying to convert TCL code to python. > > > > Have a property file from where I read some VAR's. Looks like this: > > EARPROJECT = sgs-procDist > > APPNAME = SGSProcedure > > > > > > In my TCL code I confirm the existence of the VAR = f.ex EARPROJECT by > > using code: > > > > if { ([info exists APPNAME] && [info exists STAGEDIR] && [info exists > > EARPROJECT] && [info exists EARDESTINATION]) } { > > > > > > Does anyone know and equalent way to confirm a Variable from the same > > property file using PYTHON code ??? > > You can read it with the module ConfigParser > > Diez [wsadmin] Traceback (innermost last): [wsadmin] File "", line 1, in ? [wsadmin] ImportError: no module named cfgparse -- http://mail.python.org/mailman/listinfo/python-list
Re: Retrieve ext. variables in python program
Marc 'BlackJack' Rintsch skrev: > In <[EMAIL PROTECTED]>, alfa1234 wrote: > > > Hi Diez !! > > Thanks for the reply.. Tried a little well dokumented program: > > > > # file: construct.ini > > retries = 10 > > > > # file: construct.py > > import cfgparse > > > > c = cfgparse.ConfigParser() > > c.add_option('retries', type='int') > > c.add_file('construct.ini') > > opts = c.parse() > > print 'Number of retries:',opts.retries > > > > Got the following Error when trying to run code: > > [wsadmin] Traceback (innermost last): > > [wsadmin] File "", line 1, in ? > > [wsadmin] ImportError: no module named cfgparse > > Well, the message is quite descriptive. There is no module named > `cfgparse`. Diez suggestet the `ConfigParser` modul. You notice the > difference? > > Ciao, > Marc 'BlackJack' Rintsch Hi Marc !! Did manage to download cfgparse-0.1.tar.gz which include the "cfgparse.py" module and the program seem to find the module , but when running above sample I now get the [wsadmin] ImportError: no module named Configparser Im not sure about this, but Im running all this using the Websphere 6.0 jython interface(classes = jython.jar).. Do I need some additional Python implementation in order for the pyton programs to run properly ?? I really appreciate your help out there guys... -- http://mail.python.org/mailman/listinfo/python-list
using Jython in Websphere 6.0
Used the following command to extract correct commandLine arguments to Automate deployment: AdminApp.installInteractive('z:/Builds_test/sgs/sgs-procDist.ear') Got the following Args to use for deployment.. install 'z:/Builds_test/sgs/sgs-procDist.ear' '[ -preCompileJSPs -installed.ear.destination d:/WebSphere/AppServer/profiles/profileStandAlone/installedApps/TESTND1Network -distributeApp -nouseMetaDataFromBinary -nodeployejb -appname SGSProcedure -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -MapModulesToServers [["SGS Wizard" sgs-procDist.war,WEB-INF/web.xml WebSphere:cell=TESTND1Network,node=IIS,server=webserver+WebSphere:cell=TESTND1Network,cluster=SGSProcedure]] -MapWebModToVH [["SGS Wizard" sgs-procDist.war,WEB-INF/web.xml default_host]]]' When trying to execute command below via "wsadmin -lang jython" commanfpromt I got the error below..??? Can anyone HELP ?? Traceback (innermost last): (no code object) at line 0 File "", line 1 AdminApp.install 'z:/Builds_test/sgs/sgs-procDist.ear' '[ -preCompileJS Ps -installed.ear.destination d:/WebSphere/AppServer/profiles/profileStandAlone/ installedApps/TESTND1Network -distributeApp -nouseMetaDataFromBinary -nodeployej b -appname SGSProcedure -createMBeansForResources -noreloadEnabled -nodeployws - validateinstall warn -noprocessEmbeddedConfig -MapModulesToServers [["SGS Wizard " sgs-procDist.war,WEB-INF/web.xml WebSphere:cell=TESTND1Network,node=IIS,server =webserver+WebSphere:cell=TESTND1Network,cluster=SGSProcedure]]]' ^ SyntaxError: invalid syntax wsadmin> -- http://mail.python.org/mailman/listinfo/python-list