Import issues

View: New views
6 Messages — Rating Filter:   Alert me  

Import issues

by Ron Brennan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
 
I am having an issue with trying to import Python modules. 
 
When I use "import csv" in my script I get the error: "(ImportError: no module named csv..."
 
When I enter it on the Python command prompt I get:
>>> import csv
>>> csv.__file__
'usr/lib/python2.4/csv.pyc'
 
Thoughts on wy my grinder script can't find the python module

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Import issues

by RUSSEL Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I have seen some odd problems on Ubuntu with the jython system path, so now I set it in the script properties file as follows….

 

 grinder.jvm.arguments=-Dpython.home=../../lib/jython2.2.1

 

In this case it is pointing to the location where I installed jyhton.  You might like to put in a full path, instead like “/home/scott/jython2.2.1” or wherever you installed jython…..

 

                        Hope this helps

 

 

                                                   Sc0tt….

 

 

 


From: grinder-use-bounces@... [mailto:grinder-use-bounces@...] On Behalf Of Ron Brennan
Sent: Wednesday, June 04, 2008 11:20 PM
To: grinder-use@...
Subject: [Grinder-use] Import issues

 

Hello,

 

I am having an issue with trying to import Python modules. 

 

When I use "import csv" in my script I get the error: "(ImportError: no module named csv..."

 

When I enter it on the Python command prompt I get:

>>> import csv

>>> csv.__file__

'usr/lib/python2.4/csv.pyc'

 

Thoughts on wy my grinder script can't find the python module


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Import issues

by Philip Aston :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ron Brennan wrote:

> Hello,
>  
> I am having an issue with trying to import Python modules.
>  
> When I use "import csv" in my script I get the error: "(ImportError:
> no module named csv..."
>  
> When I enter it on the Python command prompt I get:
> >>> import csv
> >>> csv.__file__
> 'usr/lib/python2.4/csv.pyc'
>  
> Thoughts on wy my grinder script can't find the python module

The Grinder distribution doesn't include the python modules.

See http://grinder.sourceforge.net/g3/scripts.html#jython-installation.
Although, you may find that setting the CLASSPATH to a different
jython.jar is not sufficient and its more reliable to set python.home
(as recommended by Scott in his mail).

- Phil

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Import issues

by Ron Brennan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Thanks for the reply guys.....but I am still having my issue with import.  I have provided all the configs I can think of.  Can anyone identify where I might have made a mistake:
 
My grinder.properties file:
....
#grinder.jvm=<Enter Stuff>
#grinder.jvm.classpath=<Enter Stuff>
grinder.jvm.arguments=-Dpython.cachedir=/tmp
grinder.jvm.arguments=-Dpython.home=/home/grinder/jython2.2.1
grinder.logDirectory=/home/grinder/grinder-3.0.1/logs/
.......
 
My error when starting the agent:
 
05/06/08 10:07:17 AM (agent): Worker process command line: java '-Dpython.home=/home/grinder/jython2.2.1' -classpath '/home/grinder/jython2.2.1/jython.jar:/home/grinder/grinder-3.0.1/lib/grinder.jar' net.grinder.engine.process.WorkerProcessEntryPoint
05/06/08 10:07:17 AM (agent): worker ronbrennandev-0 started
05/06/08 10:07:18 AM (process machine-0): Error running worker process (ImportError: no module named _csv
File "/usr/lib/python2.4/csv.py", line 7, in ?
.......
 
My Jython Registry File entry:
 
python.path = /usr/lib/python2.4:/usr/grinder/jython2.2.1/Lib
.......
 
My $PYTHONPATH:
 
/usr/lib/python2.4:/usr/lib/python2.4/plat-linux2:/usr/lib/python2.4/lib-tk:/usr/lib/python2.4/lib-dynload:/usr/lib/python2.4/site-packages
.......

RUSSEL Scott <Scott.RUSSEL@...> wrote:
I have seen some odd problems on Ubuntu with the jython system path, so now I set it in the script properties file as follows….
 
 grinder.jvm.arguments=-Dpython.home=../../lib/jython2.2.1
 
In this case it is pointing to the location where I installed jyhton.  You might like to put in a full path, instead like “/home/scott/jython2.2.1” or wherever you installed jython…..
 
                        Hope this helps
 
 
                                                   Sc0tt….
 
 
 

From: grinder-use-bounces@... [mailto:grinder-use-bounces@...] On Behalf Of Ron Brennan
Sent: Wednesday, June 04, 2008 11:20 PM
To: grinder-use@...
Subject: [Grinder-use] Import issues
 
Hello,
 
I am having an issue with trying to import Python modules. 
 
When I use "import csv" in my script I get the error: "(ImportError: no module named csv..."
 
When I enter it on the Python command prompt I get:
>>> import csv
>>> csv.__file__
'usr/lib/python2.4/csv.pyc'
 
Thoughts on wy my grinder script can't find the python module
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Import issues

by RUSSEL Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Ron,

         Firstly, given the error you are reporting, it looks as if Jython is actually finding the csv_py.  However if you look inside this file(line 7 as per your error message, you will find it is actually reporting that it cannot find the module “_csv”.  This is a module for python written in C.  So this is the module that you are missing, not csv.py.

 

       Thusly, you have found one of the modules that is not implemented as yet in jython.   I found this blog here, that offers some details…

 

http://gushieblog.blogspot.com/2006_12_13_archive.html

 

       Effectively, he references a how to on importing the _csv module to jython, which can be found here…

 

http://wiki.python.org/jython/JythonDeveloperGuide/PortingPythonModulesToJython

 

                               Probably not the “simple” solution you were looking for….  Perhaps someone else can offer an alternative solution?

 

                                                          Sc0tt…

 

 

 

 


From: grinder-use-bounces@... [mailto:grinder-use-bounces@...] On Behalf Of Ron Brennan
Sent: Thursday, June 05, 2008 6:05 PM
To: grinder-use
Subject: Re: [Grinder-use] Import issues

 

Thanks for the reply guys.....but I am still having my issue with import.  I have provided all the configs I can think of.  Can anyone identify where I might have made a mistake:

 

My grinder.properties file:

....

#grinder.jvm=<Enter Stuff>

#grinder.jvm.classpath=<Enter Stuff>

grinder.jvm.arguments=-Dpython.cachedir=/tmp

grinder.jvm.arguments=-Dpython.home=/home/grinder/jython2.2.1

grinder.logDirectory=/home/grinder/grinder-3.0.1/logs/

.......

 

My error when starting the agent:

 

05/06/08 10:07:17 AM (agent): Worker process command line: java '-Dpython.home=/home/grinder/jython2.2.1' -classpath '/home/grinder/jython2.2.1/jython.jar:/home/grinder/grinder-3.0.1/lib/grinder.jar' net.grinder.engine.process.WorkerProcessEntryPoint

05/06/08 10:07:17 AM (agent): worker ronbrennandev-0 started

05/06/08 10:07:18 AM (process machine-0): Error running worker process (ImportError: no module named _csv

File "/usr/lib/python2.4/csv.py", line 7, in ?

.......

 

My Jython Registry File entry:

 

python.path = /usr/lib/python2.4:/usr/grinder/jython2.2.1/Lib

.......

 

My $PYTHONPATH:

 

/usr/lib/python2.4:/usr/lib/python2.4/plat-linux2:/usr/lib/python2.4/lib-tk:/usr/lib/python2.4/lib-dynload:/usr/lib/python2.4/site-packages

.......

RUSSEL Scott <Scott.RUSSEL@...> wrote:

I have seen some odd problems on Ubuntu with the jython system path, so now I set it in the script properties file as follows….

 

 grinder.jvm.arguments=-Dpython.home=../../lib/jython2.2.1

 

In this case it is pointing to the location where I installed jyhton.  You might like to put in a full path, instead like “/home/scott/jython2.2.1” or wherever you installed jython…..

 

                        Hope this helps

 

 

                                                   Sc0tt….

 

 

 


From: grinder-use-bounces@... [mailto:grinder-use-bounces@...] On Behalf Of Ron Brennan
Sent: Wednesday, June 04, 2008 11:20 PM
To: grinder-use@...
Subject: [Grinder-use] Import issues

 

Hello,

 

I am having an issue with trying to import Python modules. 

 

When I use "import csv" in my script I get the error: "(ImportError: no module named csv..."

 

When I enter it on the Python command prompt I get:

>>> import csv

>>> csv.__file__

'usr/lib/python2.4/csv.pyc'

 

Thoughts on wy my grinder script can't find the python module

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

 


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Import issues

by Philip Aston-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ron Brennan wrote:

> Thanks for the reply guys.....but I am still having my issue with
> import.  I have provided all the configs I can think of.  Can anyone
> identify where I might have made a mistake:
>  
> My grinder.properties file:
> ....
> #grinder.jvm=<Enter Stuff>
> #grinder.jvm.classpath=<Enter Stuff>
> grinder.jvm.arguments=-Dpython.cachedir=/tmp
> grinder.jvm.arguments=-Dpython.home=/home/grinder/jython2.2.1

This should be sufficient.

> grinder.logDirectory=/home/grinder/grinder-3.0.1/logs/
> .......
>  
> My error when starting the agent:
>  
> 05/06/08 10:07:17 AM (agent): Worker process command line: java
> '-Dpython.home=/home/grinder/jython2.2.1' -classpath
> '/home/grinder/jython2.2.1/jython.jar:/home/grinder/grinder-3.0.1/lib/grinder.jar'
> net.grinder.engine.process.WorkerProcessEntryPoint
> 05/06/08 10:07:17 AM (agent): worker ronbrennandev-0 started
> 05/06/08 10:07:18 AM (process machine-0): Error running worker process
> (ImportError: no module named _csv
> File "/usr/lib/python2.4/csv.py", line 7, in ?

^^^ Here's your problem, your trying to load a native python version of
the csv module.

> .......
>  
> My Jython Registry File entry:
>  
> python.path = /usr/lib/python2.4:/usr/grinder/jython2.2.1/Lib
> .......

Don't mix native python installations with jython. I suggest you remove
the /usr/lib/python2.4 from this.

>  
> My $PYTHONPATH:
>  
> /usr/lib/python2.4:/usr/lib/python2.4/plat-linux2:/usr/lib/python2.4/lib-tk:/usr/lib/python2.4/lib-dynload:/usr/lib/python2.4/site-packages
> .......

The PYTHONPATH environment variable is irrelevant, AFAIK Jython doesn't
use it.


- Phil



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use