Page 1 of 1

Uploading script error: cannot import other scripts

PostPosted: Tue Jul 30, 2013 1:12 am
by tom_deschamps
Hi

I am trying to upload a script to omero through Insight.
I get an error because this script is importing another script of mine.
Even though this second script is accessible through PYTHONPATH, during upload I will get the following error:
Code: Select all
java.lang.Exception: org.openmicroscopy.shoola.env.data.DSAccessException: Cannot access data.
Cannot upload the script: my_omero_script.py.
   at ....
Caused by: omero.ValidationException
    serverStackTrace = ""
    serverExceptionClass = ""
    message = "Can't find params for 1648. Stderr is in file 1649
               ---stderr---
               Traceback (most recent call last):
                 File "./script", line 30, in <module>
                   from my_homemade_script import my_routines
               ImportError: No module named my_homemade_script

Any idea how I could get this to work?
Thanks

Re: Uploading script error: cannot import other scripts

PostPosted: Tue Jul 30, 2013 7:18 am
by jmoore
How have you added my_homemade_script to the PYTHONPATH? Could you perhaps add:
Code: Select all
import sys
print sys.path

to the top of your script so we can debug what all is present?

Thanks,
~Josh

Re: Uploading script error: cannot import other scripts

PostPosted: Tue Jul 30, 2013 7:52 am
by tom_deschamps
Hi Josh

Thanks so much for the help.
Actually the path displayed by printing the sys.path does not contain the path to my_homemade_script even though it is included in the PYTHONPATH (in the .bashrc file of the omero user account).
That means that the env variable was not read correctly when the server was started.
I'm going to look into that. That might be where my error is.
Thanks!

Tom

Re: Uploading script error: cannot import other scripts

PostPosted: Tue Jul 30, 2013 8:17 am
by jmoore
The PYTHONPATH setting in place on starting up OMERO via
Code: Select all
bin/omero admin start
should be the one in effect for the Processor. But let us know if that still doesn't work. Cheers, ~Josh.

Re: Uploading script error: cannot import other scripts

PostPosted: Mon Aug 19, 2013 10:41 pm
by tom_deschamps
Yes, it was problem of not setting the PYTHONPATH correctly when the server was started.
Thanks