View unanswered posts | View active topics It is currently Wed Apr 23, 2014 4:04 pm



Reply to topic  [ 5 posts ] 
 Python Path 
Author Message

Joined: Apr 11, 2006
Posts: 21
Post Python Path
I just turned on sql logging and I'm thinking about what to do with it. I have a little experience with python, burt for now I have one, probably naive, question. In the following code found in the web plugin, how does python find the module in the IndigoSqlClient directory?

Code: Select all
from indigopy import indigoconn as ic


And if I wrote separate python code, not in a plugin, would I have to modify the $PYTHONPATH variable to find it?


Sat Jun 26, 2010 8:20 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 8357
Location: Austin, Texas
Post Re: Python Path
I believe this article will answer your question.

_________________
Jay (Indigo Support)
Image


Sat Jun 26, 2010 8:55 am
Profile WWW

Joined: Apr 11, 2006
Posts: 21
Post Re: Python Path
Thanks. I didn't mean to sound like I was asking inappropriately basic Python question here. The thing I was curious about was specifically how the web plugins can find the code in the sql client. It is not crucial now since I am using the sqlite3 module directly now, but I could imagine if an environment variable is being inherited by child processes, a python script to generate a report that is spawned by an indigo applescript might inherit that variable and find the code with the simple import statement.

Just curious.


Sat Jun 26, 2010 7:55 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 8357
Location: Austin, Texas
Post Re: Python Path
Web plugins run in the Indigo Web Server process, which currently has it's own copy of indigopy. There currently is no including across the two processes.

You should know, however, that indigoconn isn't about the SQL database - it's about the connection between python and IndigoServer. For an example of a plugin that uses the database created by the IndigoSqlClient, check out the usageReporter in the file library.

...if an environment variable is being inherited by child processes...


If I'm understanding you, no, we aren't currently directly exposing Indigo objects to python scripts like how we expose objects in AppleScript. That may be part of the plugin API that we're developing for 5.0.

_________________
Jay (Indigo Support)
Image


Sat Jun 26, 2010 9:31 pm
Profile WWW

Joined: Apr 11, 2006
Posts: 21
Post Re: Python Path
Occams razor strikes again!

Just for completeness, I wasn't thinking about Indigo objects being directly exposed. I was thinking more old school unix where the server would set the $PYTHONPATH environment variable and a child process, for example a python process spawned by an applescript triggered by something, would inherit the parents environment and be able to find the scripts.

But with that said, never mind.


Sun Jun 27, 2010 12:34 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.