mod_python Unable to create file
Hi, I am using Apache and mod_python to service POST/GET requests on MAC OS. My script tries to create a file file = open(file_path, 'w') This fails with the following error EACCES Permission denied What is missing? Thanks, Kaushik -- http://mail.python.org/mailman/listinfo/python-list
Re: mod_python Unable to create file
On Mar 1, 11:24 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 01 Mar 2008 22:47:02 -0800, kaush wrote: > > I am using Apache and mod_python to service POST/GET requests on MAC > > OS. My script tries to create a file > > > file = open(file_path, 'w') > > > This fails with the following error > > > EACCES > > Permission denied > > > What is missing? > > To state the ovious: the rights to create a file at `file_path`. Remember > that web servers usually have their own "user". > > Ciao, > Marc 'BlackJack' Rintsch Thanks Marc. In Apache what are the ways/directives to set the rights to a folder? -- http://mail.python.org/mailman/listinfo/python-list
urlsafe_b64decoding of xml node text
Hi All, I am running Apache with mod_python. A post message to my server contains an xml of the form (some base64 ur-safe-encoded data) I use minidom to parse the xml posted, and now try to decode the data using the following import minidom import base64 decData = base64.urlsafe_b64decode(data) #data is the above mentioned url-safe-encoded data This line fails with the following error Error : Error : character mapping must return integer, None or unicode Error : If i run the same data through a script on the terminal, I am able to successfully decode the data. What could be the reason for this error? Can it be because of some encoding introduced by minidom? I think urlsafe_b64decode takes ascii string. Thanks, Kaushik -- http://mail.python.org/mailman/listinfo/python-list
ImportError while Embedding python in C
Hi All,
I have a simple python script saved to "test.py" as
import os
import base64
def Testfunction():
print "Hello World"
return
Testfunction()
I am trying to invoke this from a C program as follows
int main(int argc, char* argv[])
{
Py_Initialize();
PyObject* main_module = PyImport_AddModule("__main__");
PyObject* main_dict = PyModule_GetDict(main_module);
FILE* file_1 = fopen(TestFile, "r");
PyRun_AnyFile(file_1, TestFile);
Py_Finalize();
return 0;
}
This fails with the error
Traceback (most recent call last):
File "/home/kaushik/shadowFs/test.py", line 4, in
import base64
File "/usr/local/lib/python2.5/base64.py", line 9, in
import struct
File "/usr/local/lib/python2.5/struct.py", line 30, in
from _struct import Struct, error
ImportError: /usr/local/lib/python2.5/lib-dynload/_struct.so:
undefined symbol: PyExc_TypeError
I am able to run test.py successfully from the shell.
What am i missing in importing the base64 library?
Thanks,
Kaushik
--
http://mail.python.org/mailman/listinfo/python-list
Re: ImportError while Embedding python in C
On Mar 15, 2:10 am, kaush <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have a simple python script saved to "test.py" as
>
> import os
> import base64
>
> def Testfunction():
> print "Hello World"
> return
>
> Testfunction()
>
> I am trying to invoke this from a C program as follows
>
> int main(int argc, char* argv[])
> {
> Py_Initialize();
>
> PyObject* main_module = PyImport_AddModule("__main__");
>
> PyObject* main_dict = PyModule_GetDict(main_module);
>
> FILE* file_1 = fopen(TestFile, "r");
> PyRun_AnyFile(file_1, TestFile);
>
> Py_Finalize();
>
> return 0;
>
> }
>
> This fails with the error
>
> Traceback (most recent call last):
> File "/home/kaushik/shadowFs/test.py", line 4, in
> import base64
> File "/usr/local/lib/python2.5/base64.py", line 9, in
> import struct
> File "/usr/local/lib/python2.5/struct.py", line 30, in
> from _struct import Struct, error
> ImportError: /usr/local/lib/python2.5/lib-dynload/_struct.so:
> undefined symbol: PyExc_TypeError
>
> I am able to run test.py successfully from the shell.
>
> What am i missing in importing the base64 library?
>
> Thanks,
> Kaushik
Adding the following link options during compilation solved the
problem "-Xlinker -export-dynamic"
Thanks,
Kaushik
--
http://mail.python.org/mailman/listinfo/python-list
