Re: Python-list Digest, Vol 96, Issue 137
On Saturday 24 September 2011 01:48:29 you wrote: > Ricardo wrote: > > Hi everyone > > I'm trying to use the cgi library to create a python script and loading > > it from a web page. I have already done the necessary imports, and the > > default commands to receive data from "html" are written too. The final > > version is something like this: > > > > #!/usr/bin/python > > > > import subprocess > > import cgi > > import cgitb > > > > cgitb.enable() > > > > input = cgi.FieldStorage() > > > > …. my code (do something with input)…. > > > > > > #printing the response > > > > print "Content-Type: text/html" > > print > > print "My title:" > > print "" > > print "" > > print ….. bla bla … > > print "%s"%theoutput > > print "" > > > > Besides, my call from my index.html is like this: > > > > > > > > > > > > > > > > > > well, the thing is that when i do the call from the browser: > > > > http://localhost/index.html > > > > V > > > > put the data and click on the "accept" button > > > > V > > > > http:/localhost/scripts/python_script.py > > > > I only get the python_script.py as a plain test by response (the script > > printed on my browser). I have already changed the permissions for > > python_script.py. I have checked the import cgi,cgitb in the python shell > > (i am using v2.7) and they work fine. So, i don't know what it is going > > wrong here. > > > > A little help please… any idea? > > Is your webserver configured to allow cgi scripts? In the scripts > directory? For Apache see > > http://httpd.apache.org/docs/current/howto/cgi.html > > Python also comes with a CGI Server. A quick-and-dirty setup goes like > this: > > $ cat cgi-bin/script.py > #!/usr/bin/python > # -*- coding: utf-8 -*- > > import cgi > import cgitb > > cgitb.enable() > > input = cgi.FieldStorage() > > print "Content-Type: text/html" > print > print "My title:" > print "" > print "" > print "Hello world" > print "" > $ chmod a+x cgi-bin/script.py > $ python -m CGIHTTPServer > Serving HTTP on 0.0.0.0 port 8000 ... > > If you then point your browser to http://localhost:8000/cgi-bin/script.py > you should see > > Hello world > > in the browser and (something like) > > localhost - - [24/Sep/2011 08:41:27] "GET /cgi-bin/script.py HTTP/1.1" 200 > - > > in the shell. Note that the script must be in cgi-bin (or htbin) unless you > start the server with a custom script that modifies > CGIHTTPRequestHandler.cgi_directories accordingly. Thanks a lot, for your answer. Yes, i can run scripts from /cgi-bin/. Actually I follow you example and it works really well. I didn't know at all about this CGI server. I am doing the hole thing over python now, it's nice. Thanks again. -- (...)Also, since that same law states that any system able to prove its consistency to itself must be inconsistent; any mind that believes it can prove its own sanity is, therefore, insane.(...) Kurt Gödel. -- http://mail.python.org/mailman/listinfo/python-list
Re: Motion Tracking with Python
On Thursday 29 September 2011 21:16:52 you wrote: > Hello, > I have a neat Python project I'd like to share. It does real-time motion > tracking, using the Python bindings to the OpenCV library: > > http://derek.simkowiak.net/motion-tracking-with-python/ > > There is a YouTube video showing the script in action. > > It's especially neat because my daughter and I worked together on this > project. We used it to track her two pet gerbils, as part of her science > fair project. She wrote her own (separate) Python script to read the > motion tracking log files, compute distance and velocity, and then > export those values in a CSV file. Like I say on the web page: "I’m > convinced that Python is the best language currently available for > teaching kids how to program." > > I also use Python professionally, and it's worked out great every time. > There's no job Python can't handle. > > > Thanks, > Derek Simkowiak > http://derek.simkowiak.net Hi, this is awesome!! I'm currently working in something similar, but I am having problems with getting data from the CCD (basically i don't know how to do it :), can you give me a tip for doing this? Or explain how you did it please? I not a newbie at python but not as experienced as evidently you are. Thanks a lot in advance. -- (...)Also, since that same law states that any system able to prove its consistency to itself must be inconsistent; any mind that believes it can prove its own sanity is, therefore, insane.(...) Kurt Gödel. -- http://mail.python.org/mailman/listinfo/python-list
Tweepy: Invalid arguments at function call (tweepy.Stream())
Hi i'm trying to fetch realtime data from twitter using tweepy.Stream(). So I have tried the following... After successfully authenticate using oauth: auth = tweepy.OAuthHandler(...) (it works fine, i have my access_token.key and secret) i did: streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout='90') and: streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout='90') none of this works, it keeps giving me the same error: Traceback (most recent call last): File "", line 1, in streaming_api = tweepy.streaming.Stream(auth, CustomStreamListener(), timeout='60') TypeError: *init*() takes at least 4 arguments (4 given) then i have searched for the parameters of the function: tweedy.streaming.Stream(login,password,Listener(),...etc) but i thought this login and pass was the authentication method using in the basic authentication not in the oauth case. Now i'm really confused, a little help please? pd: As you can see, i'm trying to get realtime data from twitter (and make some further NLP with it), i have chose tweepy because the dev.twitter.compage recommended it, but if you have any other suggestion for doing this, it will be welcomed -- http://mail.python.org/mailman/listinfo/python-list
Re: Tweepy: Invalid arguments at function call (tweepy.Stream()) (Terry Reedy)
Thanks a lot for your answer. I'm using python 2.7.2 and tweetpy 1.7 >>> help(tweepy) Help on package tweepy: NAME tweepy - Tweepy Twitter API library (...) VERSION 1.7.1 and probably that is the problem, the link that you gave me refers to the 1.2 version page... Anyway, i already have their IRC direction and i think it would be easier to find support there. Thanks again. Ricardo Mansilla ps: sometimes i get lazy about writing the whole link to a precise direction which lacks of importance in my point; please, don't judge me for my exquisite way of keep the attention in the correct place... :) -- http://mail.python.org/mailman/listinfo/python-list
Does py2app improves speed?
Hi everyone.. My question is exactly as in the subject of This Mail. I have made a Python script which is to slow and i have heard (and common sense also suggest) that if you use some libraries to "frozen" the script the performance improves substantially. So I need to know; is This a myth or it is a fact? Thanks in advance for your time. -- http://mail.python.org/mailman/listinfo/python-list
Re: Does py2app improves speed?
Well, that's sad... I think Im gonna end getting back to C++ for This. But anyway, thanks a lot for the quick answer... Bye. -- http://mail.python.org/mailman/listinfo/python-list
Re: Does py2app improves speed?
Most of méthods for improving the speed are related to efficient memory management and using specific structures for a specific tasks... But i have already optimized my code (which is very short actually) following all these rules and it is very slow yet. Do you think there is another way to do This? Probably i'm missing something here... On 24/11/2011, at 07:38, Dave Angel wrote: > On 11/24/2011 08:26 AM, Ricardo Mansilla wrote: >> Well, that's sad... I think Im gonna end getting back to C++ for This. But >> anyway, thanks a lot for the quick answer... >> Bye. > Just because Py2app doesn't improve speed doesn't mean there aren't other > ways to gain speed, while still using the Python language for all or most of > the app. There have been lots of threads on the topic. > > -- > > DaveA > -- http://mail.python.org/mailman/listinfo/python-list