|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
import os queryI have some Grinder 3.1 scripts which will be running on Windows XP2/CentOS 5 machines so I need to be able to normalise path names.
I have the following directory structure on all machines, where on the XP machines '/' is equivalent to 'C:\'
/ | +-Testdata | +-CertificatesI would normally normalise path names like this:
import os
...
keystore = os.path.normpath("/TestData/Certificates/" + certificateName)
grinder.SSLControl.setKeyStoreFile(keystore, certificatePassword, "pkcs12")
But in The Grinder that gives the following error:
14/05/09 16:57:09 (thread 0 run 0): Aborted run due to Jython exception: ImportError: no module named javaos [calling TestRunner]In the error logs the error occurs at the line number where I invoke os.path.normpath
I've looked in the jython.jar file which is in the Grinder lib directory and the os.class is there as part of org.python.modules.
So I tried:
from org.python.modules import oswhich gives the same error, at the same point. Trying import javaosgives the same error but at the line where I do the import. Is there a way of importing either the os or javaos module which doesn't involve me installing Jython? |
|
|
Re: import os queryhave you tried doing a full install of jython?
or maybe try: from os import path keystore = path.normpath("/TestData/Certificates/" + certificateName) 2009/5/14 nick3216 <nick.wallis@...>: > I have some Grinder 3.1 scripts which will be running on Windows XP2/CentOS > 5 machines so I need to be able to normalise path names. I have the > following directory structure on all machines, where on the XP machines '/' > is equivalent to 'C:\' > > / > | > +-Testdata > | > +-Certificates > > I would normally normalise path names like this: > > import os > ... > keystore = os.path.normpath("/TestData/Certificates/" + certificateName) > grinder.SSLControl.setKeyStoreFile(keystore, certificatePassword, > "pkcs12") > > But in The Grinder that gives the following error: > > 14/05/09 16:57:09 (thread 0 run 0): Aborted run due to Jython exception: > ImportError: no module named javaos [calling TestRunner] > > In the error logs the error occurs at the line number where I invoke > os.path.normpath I've looked in the jython.jar file which is in the Grinder > lib directory and the os.class is there as part of org.python.modules. So I > tried: > > from org.python.modules import os > > which gives the same error, at the same point. Trying > > import javaos > > gives the same error but at the line where I do the import. Is there a way > of importing either the os or javaos module which doesn't involve me > installing Jython? > ________________________________ > View this message in context: import os query > Sent from the Grinder - User mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world - but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK > i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > _______________________________________________ > grinder-use mailing list > grinder-use@... > https://lists.sourceforge.net/lists/listinfo/grinder-use > > ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ grinder-use mailing list grinder-use@... https://lists.sourceforge.net/lists/listinfo/grinder-use |
|
|
Re: import os queryThat gives exactly the same javaos error: 15/05/09 09:00:39 (thread 0 run 0): Aborted run due to Jython exception: ImportError: no module named javaos [calling TestRunner]
As the os.class is included in the jython.jar that comes with The Grinder I don't understand why I should need to do a Jython install when the class is already there in the lib directory. If I include jython.jar in my classpath I can see it being processed when the agent starts, and annoyingly the path is being normalised by The Grinder. I say annoying because obviously The Grinder can do what I'm trying to do: grinder.properties:grinder.jvm.classpath = /grinder-3.1/lib/jython.jarXP Console output when agent starts - jython.jar processed and path to it is normalised: *sys-package-mgr*: processing new jar, 'C:\grinder-3.1\lib\jython.jar' I was also trying to avoid installing Jython as I have a batch of machines acting as injectors and as well as updating them all I'd have to work around the differences between CentOS5 and Windows XP jython installations. Also at some point I might need to run my scripts from the Amazon EC2 and I don't want to have to bother about the configuration of the load injectors there. Is there a way of importing the os.class in the jython.jar in The Grinder lib directory? Alternatively as The Grinder is a java app is there no simple way of importing javaos? This would provide me with the same functionality. |
|
|
Re: import os queryif there is a java class that provides what you need you can import
that and use it within Jython: maybe: java.io.File or java.net.URI java.net.URI has a normalize method (http://java.sun.com/j2se/1.5.0/docs/api/java/net/URI.html#normalize()) eg: from java.net import URI certificate = URI(/TestData/Certificates/" + certificateName) certificate = certificate.normalize() On the jython classes I always tend to do a full install of jython, and I was able to get os.path.normpath working fine...which is not a lot of help. Cal 2009/5/15 nick3216 <nick.wallis@...>: > Calum Fitzgerald wrote: > from os import path > keystore = path.normpath("/TestData/Certificates/" + certificateName) > > That gives exactly the same javaos error: > > 15/05/09 09:00:39 (thread 0 run 0): Aborted run due to Jython exception: > ImportError: no module named > javaos [calling TestRunner] > > Calum Fitzgerald wrote: > have you tried doing a full install of jython? > > As the os.class is included in the jython.jar that comes with The Grinder I > don't understand why I should need to do a Jython install when the class is > already there in the lib directory. > > If I include jython.jar in my classpath I can see it being processed when > the agent starts, and annoyingly the path is being normalised by The > Grinder. I say annoying because obviously The Grinder can do what I'm trying > to do: > > grinder.properties: > > grinder.jvm.classpath = /grinder-3.1/lib/jython.jar > > XP Console output when agent starts - jython.jar processed and path to it is > normalised: > > *sys-package-mgr*: processing new jar, 'C:\grinder-3.1\lib\jython.jar' > > I was also trying to avoid installing Jython as I have a batch of machines > acting as injectors and as well as updating them all I'd have to work around > the differences between CentOS5 and Windows XP jython installations. Also at > some point I might need to run my scripts from the Amazon EC2 and I don't > want to have to bother about the configuration of the load injectors there. > > Is there a way of importing the os.class in the jython.jar in The Grinder > lib directory? > > Alternatively as The Grinder is a java app is there no simple way of > importing javaos? This would provide me with the same functionality. > > ________________________________ > View this message in context: Re: import os query > Sent from the Grinder - User mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > grinder-use mailing list > grinder-use@... > https://lists.sourceforge.net/lists/listinfo/grinder-use > > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ grinder-use mailing list grinder-use@... https://lists.sourceforge.net/lists/listinfo/grinder-use |
|
|
Re: import os queryThat normalizes URI's so keeps forward slashes as forward slashes
I've looked and I may end up having to use java.io.File. If it's so simple to import java I still don't understand why I can't import javaos or the os class that's in the jython.jar. ![]() |
|
|
Re: import os queryI'm not sure why you are having trouble with importing the python os
class in the jython.jar you should be able to import javaos java classes very simply. is it part of the core java classes? if not just drop the jar into the classpath and you should be able to import away. 2009/5/15 nick3216 <nick.wallis@...>: > Calum Fitzgerald wrote: > java.net.URI has a normalize method > (http://java.sun.com/j2se/1.5.0/docs/api/java/net/URI.html#normalize()) > > That normalizes URI's so keeps forward slashes as forward slashes > > Calum Fitzgerald wrote: > if there is a java class that provides what you need you can import that and > use it within Jython: > > I've looked and I may end up having to use java.io.File. If it's so simple > to import java I still don't understand why I can't import javaos or the os > class that's in the jython.jar. > ________________________________ > View this message in context: Re: import os query > Sent from the Grinder - User mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > grinder-use mailing list > grinder-use@... > https://lists.sourceforge.net/lists/listinfo/grinder-use > > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ grinder-use mailing list grinder-use@... https://lists.sourceforge.net/lists/listinfo/grinder-use |
|
|
Re: import os query
There is no javaos module in Java - in fact having just checked it's deprecated by Sun. I don't see why if I could find a jar file for it I'd have any more success accessing the classes inside it than I do trying to import from jython.jar which I can see includes the class I'm after. No neither am I. If I include jython.jar in my classpath I'd expect to be able to access the os class within it thusly: from org.python.modules import osHowever this doesn't work: 19/05/09 14:44:06 (thread 0 run 0): Aborted run due to Jython exception: ImportError: no module named javaos [calling TestRunner]Which is where we came in... |
|
|
Re: import os query1. Install a full version of Jython. 2. Use grinder.jvm.arguments to set the Python home appropriately. E.g. java -Dgrinder.jvm.arguments=-Dpython.home=/opt/jython/jython2.2.1/ net.grinder.Grinder (can also be done in grinder.properties) - Phil nick3216 wrote: > Calum Fitzgerald wrote: > >> you should be able to import javaos java classes very simply. is it >> part of the core java classes? if not just drop the jar into the >> classpath and you should be able to import away. >> >> > > <p>There is no javaos module in Java - in fact having just checked it's > deprecated by Sun. I don't see why if I could find a jar file for it I'd > have any more success accessing the classes inside it than I do trying to > import from jython.jar which I can see includes the class I'm after.</p> > > > Calum Fitzgerald wrote: > >> I'm not sure why you are having trouble with importing the python os >> class in the jython.jar >> >> > > No neither am I. If I include jython.jar in my classpath I'd expect to be > able to access the os class within it thusly: > > <pre> > from org.python.modules import os > </pre> > > However this doesn't work: > > <pre> > 19/05/09 14:44:06 (thread 0 run 0): Aborted run due to Jython exception: > ImportError: no module named > javaos [calling TestRunner] > </pre> > > and we're back at square one. > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ grinder-use mailing list grinder-use@... https://lists.sourceforge.net/lists/listinfo/grinder-use |
|
|
Re: import os queryI have the SAME problem. Does anyone solve it ??? |
| Free embeddable forum powered by Nabble | Forum Help |