mod_python form upload: permission denied sometimes...

P

psaffrey

I have a mod_python application that takes a POST file upload from a
form. It works fine from my machine, other machines in my office and
my home machine. It does not work from my bosses machine in a
different city - he gets "You don't have permission to access this on
this server".

In the logs, it's returned 403. I also have this error in error.log:

Cannot traverse upload in /pythonapps/wiggle/form/upload because
<function form at 0x7fe7568e31b8> is not a traversable object,
referer: ...

Could this be a network level problem? If so, why does it work from my
home machine but not my bosses machine?? The file to upload is quite
large - 7MB.
 
K

Krishnakant

hello all,
I was doing my first complete python packaging for my software and I am
totally confused.
I see, /usr/local/lib/python-2.6/site-packages and also dist-packages.
Then I also see a directory called pyshare, then again site-packages in
usr/lib/python (I am not even remembering correct paths for many such
locations ).

Now my question is, which the perfect place? I would like to know if I
write a distutils based setup.py for my application, then which is the
place which I should choose?

happy hacking.
Krishnakant.
 
D

David Cournapeau

hello all,
I was doing my first complete python packaging for my software and I am
totally confused.
I see, /usr/local/lib/python-2.6/site-packages and also dist-packages.
Then I also see a directory called pyshare, then again site-packages in
usr/lib/python (I am not even remembering correct paths for many such
locations ).

Some of those locations are OS specific - pyshare is specific to
debian I think, for example.
Now my question is, which the perfect place?  I would like to know if I
write a distutils based setup.py for my application, then which is the
place which I should choose?

I am not sure I understand: your package setup and installation
location are totally independent. Once you finish your package, you
can install it wherever you want, using the --prefix option of the
distutils install command. You should avoid using /usr as an
installation prefix, because it is generally assumed to be owned by
the system. /usr/local is not, though.

David
 
K

Krishnakant

Some of those locations are OS specific - pyshare is specific to
debian I think, for example.
My Basic question is that, what package directory is Standard as far as
all gnu/linux distros are concerned?
In other words I would like to know if there is some package directory
which is searched by default for installed packages? I believed it
was /usr/local/lib/python2.6/site-packages.
In the case of python 2.5 it must be the same, but correct me if I am
wrong. I want my distutils setup.py to setup the package so that an
import statement can import the package no matter what distro of
gnu/linux we are running.

happy hacking.
Krishnakant.
 
K

Krishnakant

Python has a habit of generating, and expecting to find,
platform-specific files (‘foo.pyo’ extension modules), compiled bytecode
files (‘foo.pyc’), and module source files (‘foo.py’) necessarily in the
same directory for purpose of locating them at import time.
Thanks a lot for this information.
So now if I say for example choose ubuntu and debian for my testing
purpose, should I put all the packages I make
into /usr/local/lib/python2.6/site-packages? Will this be a safe choice
for at least debian and Ubuntu?

I will later on think of fedora etc.

happy hacking.
Krishnakant.
 
C

Chris Rebert

Python has a habit of generating, and expecting to find,
platform-specific files (‘foo.pyo’ extension modules)

Erm, .pyo-s aren't platform-specific. According to
http://docs.python.org/dev/tutorial/modules.html#compiled-python-files
:

When the Python interpreter is invoked with the -O flag, optimized
code is generated and stored in .pyo files. The optimizer currently
doesn’t help much; it only removes assert statements.

Passing two -O flags to the Python interpreter (-OO) will cause the
bytecode compiler to perform optimizations that could in some rare
cases result in malfunctioning programs. Currently only __doc__
strings are removed from the bytecode, resulting in more compact .pyo
files.

A program doesn’t run any faster when it is read from a .pyc or .pyo
file than when it is read from a .py file; the only thing that’s
faster about .pyc or .pyo files is the speed with which they are
loaded.


It's not like .pyo-s are compiled C extension modules.

Cheers,
Chris
 
L

Lawrence D'Oliveiro

In message <0fc15bee-003a-45ca-
(e-mail address removed)>, (e-mail address removed)
wrote:
I have a mod_python application that takes a POST file upload from a
form. It works fine from my machine, other machines in my office and
my home machine. It does not work from my bosses machine in a
different city - he gets "You don't have permission to access this on
this server".

In the logs, it's returned 403. I also have this error in error.log:

Cannot traverse upload in /pythonapps/wiggle/form/upload because
<function form at 0x7fe7568e31b8> is not a traversable object,
referer: ...

Sounds like a bug in your code. Have you tried uploading a smaller file?
What's different about the setup on your boss's machine? OS? Browser?
Addons?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top