Python can open file, PL/Python can't
<p>Connected to mydb in PostgreSQL:</p>

<pre><code>mydb=# CREATE FUNCTION file_test () RETURNS text AS $$
if open('mydir/myfile.xsl'): return 'success' 
$$ LANGUAGE plpythonu;
CREATE FUNCTION
mydb=# SELECT file_test();
ERROR:  IOError: [Errno 2] No such file or directory: 'mydir/myfile.xsl'
CONTEXT:  Traceback (most recent call last):
  PL/Python function "file_test", line 2, in &lt;module&gt;
    if open('mydir/myfile.xsl'): return 'success'
PL/Python function "file_test"
</code></pre>

<p>Over to Python:</p>

<pre><code>&gt;&gt;&gt; if open('mydir/myfile.xsl'): print 'success'
... 
success
&gt;&gt;&gt; 
</code></pre>

<p>An absolute path didn't seem to help PL/Python. What I'd like to do is use Postgres's query_to_xml() and run an XSLT transformation on the return. But to do that I'll need to read the xsl file...</p>