Problems with wsgi Python3

hidura at gmail.com hidura at gmail.com
Fri Oct 1 00:33:36 EDT 2010


Now, i' m sure that the system it's uploading the file but still it's give  
me empty the information. I am considerating 2 crazy solutions what i want  
to share with you for listen your opinions:

1) Consist in translate to Python2.5 the area what receives the request and  
execute the area what begin the process with Python3.1 and wait to the  
other finish with the processing to read a file in where the other part  
write the result.
2) It's less crazy than the 1 and consist in strip the  
cpEnv["wsgi.input"].read() and take the information and begin the reading  
line by line in order to insert the information in the corresponding areas.

Waiting for your opinions and very happy with your help.

Diego Hidalgo.

On Sep 30, 2010 11:56pm, hidura at gmail.com wrote:
> Ppl, thankyou Diez and Thomas for your answers i did it, but it present  
> me a problem with the solution what you give me Thomas this is the code:

> ValueError: Invalid boundary in multipart form: ''

> On Sep 30, 2010 6:16pm, hidura at gmail.com wrote:
> > I still receive nothing, here it's the code of the form maybe there  
> it's the problem:
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sep 30, 2010 4:55pm, "Diez B. Roggisch" deets at web.de> wrote:
> > > Thomas Jollans thomas at jollybox.de> writes:
> > >
> > >
> > >
> > > > On Thursday 30 September 2010, it occurred to hidura at gmail.com to  
> exclaim:
> > >
> > > >> What mean this
> > >
> > > >> -----------------------------743346150198628700241600224--\r?
> > >
> > > >
> > >
> > > > it looks like a MIME boundary. In this context most likely from a
> > >
> > > > multipart/form-data transmission.
> > >
> > >
> > >
> > > yep, as one can see in the headers below.
> > >
> > >
> > >
> > > Additonally, it looks to me as if the form you are submitting is
> > >
> > > empty. The content-length of just 61 matches barely the boundary.
> > >
> > >
> > >
> > > Use something like
> > >
> > >
> > >
> > > pdict = cgi.parse_header(environ["CONTENT_TYPE"])[1]
> > >
> > > cgi.parse_multipart(environ["wsgi.input"], pdict)
> > >
> > >
> > >
> > > to properly parse the request. But then of course actually upload
> > >
> > > something.
> > >
> > >
> > >
> > > Diez
> > >
> > >
> > >
> > >
> > >
> > > >
> > >
> > > >>
> > >
> > > >> On Sep 30, 2010 2:38pm, hidura at gmail.com wrote:
> > >
> > > >> > Sorry, for the last mail, here it's what you asked:
> > >
> > > >> >
> > >
> > > >> > {'CONTENT_LENGTH': '61',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'multipart/form-data;
> > >
> > > >> >  
> boundary=---------------------------8905735096173894531259794847',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'DOCUMENT_ROOT':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010]  
> [error] '/home/hidura/webapps/karinapp/Suite',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'GATEWAY_INTERFACE':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'CGI/1.1',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010]
> > >
> > > >> > [error]
> > >
> > > >>  
> > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', [Thu
> > >
> > > >> > Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_CHARSET':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010]  
> [error] 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_ENCODING':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'gzip,deflate',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_ACCEPT_LANGUAGE':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'es-do,en-us;q=0.7,en;q=0.3',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_CONNECTION':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'close',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_HOST':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_REFERER':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010]
> > >
> > > >> > [error] 'http://hidura.webfactional.com/?md=btdump',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_USER_AGENT':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'Mozilla/5.0 (X11; U; Linux  
> x86_64;
> > >
> > > >> > en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid)  
> Firefox/3.6.10',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP_X_FORWARDED_FOR':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '190.94.122.180',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'PATH_INFO':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'QUERY_STRING':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'REMOTE_ADDR':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'REMOTE_PORT':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '58742',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'REQUEST_METHOD':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'POST',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'REQUEST_URI':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '/Gate.py',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_FILENAME':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010]
> > >
> > > >> > [error] '/home/hidura/webapps/karinapp/Suite/Gate.py',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SCRIPT_NAME':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '/Gate.py',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADDR':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '127.0.0.1',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_ADMIN':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '[no address given]',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_NAME':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'hidura.webfactional.com',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_PORT':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '80',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_PROTOCOL':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'HTTP/1.0',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_SIGNATURE':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'SERVER_SOFTWARE':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'Apache/2.2.15 (Unix)  
> mod_wsgi/3.3
> > >
> > > >> > Python/3.1',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.application_group':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'web152.webfaction.com| 
> /gate.py',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.callable_object':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'application',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.handler_script':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.input_chunked':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '0',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_host':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_port':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '51543',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.process_group':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.request_handler':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi-script',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.script_reloading':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] '1',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.version':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] (3, 3),
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.errors':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] ,
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.file_wrapper':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] ,
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.input':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] ,
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.multiprocess':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] False,
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.multithread':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] True,
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.run_once':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] False,
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.url_scheme':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'http',
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] 'wsgi.version':
> > >
> > > >> > [Thu Sep 30 13:35:07 2010] [error] (1, 1)}
> > >
> > > >> >
> > >
> > > >> > On Sep 30, 2010 1:56pm, "Diez B. Roggisch" deets at web.de> wrote:
> > >
> > > >> > > *sigh*
> > >
> > > >> > >
> > >
> > > >> > >
> > >
> > > >> > >
> > >
> > > >> > > AGAIN, please do *not* reply to me personally. Reply to the ML  
> or NG
> > >
> > > >> >
> > >
> > > >> > you are posting in. I'm beginning to believe that it's a waste  
> of time to
> > >
> > > >> > answer you since you seem not able to follow even the most  
> simple of
> > >
> > > >> > advice and rules.
> > >
> > > >> >
> > >
> > > >> > > And read the answers you get thoroughly, you did not give all  
> the
> > >
> > > >> >
> > >
> > > >> > information I asked you for.
> > >
> > > >> >
> > >
> > > >> > > On Sep 30, 2010, at 7:08 PM, hidura at gmail.com wrote:
> > >
> > > >> > > > The output is:
> > >
> > > >> > > >
> > >
> > > >> > > >
> > >
> > > >> > > >
> > >
> > > >> > > >  
> -----------------------------110550484811701713451664404475--\r
> > >
> > > >> > > >
> > >
> > > >> > > >
> > >
> > > >> > > >
> > >
> > > >> > > > No more i don 't know what that means or what do with this.
> > >
> > > >> > > >
> > >
> > > >> > > > On Sep 30, 2010 11:55am, "Diez B. Roggisch" deets at web.de>  
> wrote:
> > >
> > > >> > > > > hidura at gmail.com writes:
> > >
> > > >> > > > > > Hello list, i had seriously troubles with the connection  
> between
> > >
> > > >> >
> > >
> > > >> > a form and the
> > >
> > > >> >
> > >
> > > >> > > > > > wsgi, i' ve made an application on Python3 and was  
> running
> > >
> > > >> >
> > >
> > > >> > perfectly but when i
> > >
> > > >> >
> > >
> > > >> > > > > > try to use the to pass the data this can't be see on the  
> server,
> > >
> > > >> >
> > >
> > > >> > so what
> > >
> > > >> >
> > >
> > > >> > > > > > is your recommendation?, i am open to all the ideas less  
> leave to
> > >
> > > >> >
> > >
> > > >> > Python2 i
> > >
> > > >> >
> > >
> > > >> > > > > > can't all the project was write on Python3, i was  
> looking into
> > >
> > > >> >
> > >
> > > >> > the PEP 444
> > >
> > > >> >
> > >
> > > >> > > > > > proposal too.
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > > Here is the code what i used to take the data:
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >  
> print(urllib.parse.parse_qs(environ['wsgi.input'].read(int(enviro
> > >
> > > >> > > > > > n
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > >
> > >
> > > >> > > > > > ['CONTENT_LENGTH'])).decode()))
> > >
> > > >> > > > >
> > >
> > > >> > > > > What is the ouptut of this? What does
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > > import pprint
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > > pprint.pprint(environ)
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > > give you?
> > >
> > > >> > > > >
> > >
> > > >> > > > > > and here it's what the os.environ.item() prints to me:
> > >
> > > >> > > > > That's irrelevant. The WSGI-environ is what is needed.
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > > Diez
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > > --
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > >
> > >
> > > >> > > > > http://mail.python.org/mailman/listinfo/python-list
> > >
> > > --
> > >
> > > http://mail.python.org/mailman/listinfo/python-list
> > >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101001/0f21e3ca/attachment.html>


More information about the Python-list mailing list