Python Path

Posted on
Sat Jun 26, 2010 8:20 am
jocary offline
Posts: 21
Joined: Apr 11, 2006

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?

Posted on
Sat Jun 26, 2010 8:55 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python Path

I believe this article will answer your question.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jun 26, 2010 7:55 pm
jocary offline
Posts: 21
Joined: Apr 11, 2006

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.

Posted on
Sat Jun 26, 2010 9:31 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

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)
Twitter | Facebook | LinkedIn

Posted on
Sun Jun 27, 2010 12:34 pm
jocary offline
Posts: 21
Joined: Apr 11, 2006

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 27 guests