python and ubuntu's environment

Tung Thanh con500thoi at yahoo.com
Tue Jul 23 15:48:18 UTC 2013


Thank you for your very useful and fast answer 
there is command or somehow that I can change my our username mywps to be able for calling wps web services or there is the command line how to check for which username and permission were pointed when I run web service from outside or locally

I was sucked for more than one week,

Many Thanks

T.X.Tung


________________________________
 From: Patrick Asselman <iceblink at seti.nl>
To: ubuntu-users at lists.ubuntu.com 
Sent: Tuesday, July 23, 2013 4:01 PM
Subject: Re: python and ubuntu's environment
 

On 2013-07-23 15:14, Tung Thanh wrote:
> Thank Patrick
>
> my python version is
>
> mycrt009:~$ python
> Python 2.6.8 (default, Apr 26 2013, 16:32:35)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more 
> information.
>
>>>>
>
> and Grass version is
>
>>>> import sys
>>>> print sys.path
> ['', '/usr/local/grass-6.4.3svn/scripts',
> '/usr/local/grass-6.4.3svn/etc/python', '/usr/lib/python2.6',
> '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
> '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
> '/usr/local/lib/python2.6/dist-packages',
> '/usr/lib/python2.6/dist-packages']
>>>> python
>
> I tried import grass script, It is fine..example
>
> :~$ python
> Python 2.6.8 (default, Apr 26 2013, 16:32:35)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more 
> information.
>>>> import grass.script as g
>>>> g.run_command("g.list", flags="f", type="rast,vect")
> 0
>>>>
>
> BUt when I tried to call web service by Curl, It says "in
> <module>import grass.script as grassImportError: No module named
>> grass.script"
>
> And all of my folder It puted in new user (username) I create new
> username by $> adduser mywps
> and all the folder such as
> home -
>  mywps
>  tomcat (hosting my wps service)
>  grass_python
>  data
>
> I hope it is clear for you to see what my problem is
>
> Many thanks
>
> T.X.Tung

So your service is running under a different user called mywps. 
Apparently that user does not have the grass.script in his sys.path.

I think you need to do some Googling on "Python module import path"...

Or do some debugging... have your script write back the sys.path and 
working directory, see where that leads to.

Best regards,
Patrick Asselman


-- 
ubuntu-users mailing list
ubuntu-users at lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20130723/2ca7a9f8/attachment.html>


More information about the ubuntu-users mailing list