title
stringlengths
10
172
question_id
int64
469
40.1M
question_body
stringlengths
22
48.2k
question_score
int64
-44
5.52k
question_date
stringlengths
20
20
answer_id
int64
497
40.1M
answer_body
stringlengths
18
33.9k
answer_score
int64
-38
8.38k
answer_date
stringlengths
20
20
tags
list
How do I make a command line program that takes arguments?
2,335,989
<p>How can I make a command line, so I can execute my program on Windows with some parameters...</p> <p>For example:</p> <pre><code>C:/Program/App.exe -safemode </code></pre>
1
2010-02-25T17:11:28Z
2,336,802
<p>One of the many ways:</p> <pre><code>import sys print sys.argv </code></pre> <pre><code> >>>python arg.py arg1 arg2 ['arg.py', 'arg1', 'arg2'] </code> </pre> <p><br/><br/> sys.argv is a list containing all the arguments (also the name of script/program) as string.</p>
0
2010-02-25T19:05:55Z
[ "python", "windows", "command-line" ]
Convert dbus.String to normal string
2,336,127
<p>I am using dbus to get the current playing song from Songbird Media Player &amp; Metadata is also taken from dbus object.</p> <p>The line where error comes is:-</p> <pre><code>audio_file = MP3(current_playing_track['location'], ID3=ID3) </code></pre> <p>The error is:-</p> <pre><code> Traceback (most recent call ...
1
2010-02-25T17:28:32Z
2,336,131
<p>Just do <code>str( your_dbus_string )</code></p>
4
2010-02-25T17:29:12Z
[ "python", "string", "dbus" ]
Baby steps to a solution with django and mod-wsgi on os x
2,336,253
<p>I'm running apache / os x and serving up localhost pages to test django on my laptop. I've already verified all the following </p> <p>• python is working fine and up to date (2.5.1)</p> <p>• django available to python and up to date (1,1,0, 'final', 0)</p> <p>• mod_wsgi module is loaded among apache module...
2
2010-02-25T17:42:50Z
2,347,678
<p>Try adding /users/useracct/Sites/ a to your pythonpath in your wsgi file:</p> <pre><code>import os import sys ..... sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..') .... </code></pre>
2
2010-02-27T14:41:08Z
[ "python", "django", "apache", "osx", "mod-wsgi" ]
Output of python scripts displayed only at termination when using SSH?
2,336,270
<p>I'm running a script to manage processes on a remote (SSH) machine. Let's call it <strong>five.py</strong></p> <pre><code>#!/usr/bin/python import time, subprocess subprocess.call('echo 0',shell=True) for i in range(1,5): time.sleep(1) print(i) </code></pre> <p>If i now run </p> <pre><code>ssh user@host fi...
4
2010-02-25T17:46:07Z
2,336,348
<p>A possible solution found in <a href="http://stackoverflow.com/questions/890991/bash-script-to-ssh-into-a-box-and-get-me-to-a-python-shell">another topic</a>, suggests I use</p> <pre><code>ssh -t user@host ./five.py </code></pre> <p>which fakes a terminal. Only drawback, ssh prints</p> <pre><code>Connection to ho...
2
2010-02-25T17:57:21Z
[ "python", "ssh", "stdout" ]
Output of python scripts displayed only at termination when using SSH?
2,336,270
<p>I'm running a script to manage processes on a remote (SSH) machine. Let's call it <strong>five.py</strong></p> <pre><code>#!/usr/bin/python import time, subprocess subprocess.call('echo 0',shell=True) for i in range(1,5): time.sleep(1) print(i) </code></pre> <p>If i now run </p> <pre><code>ssh user@host fi...
4
2010-02-25T17:46:07Z
2,336,366
<p>You can replace the <code>sys.stdout</code> object so that it automatically flushes after each write. This will also affect the <code>print</code> statement. An example, taken from <a href="http://stackoverflow.com/questions/230751/how-to-flush-output-of-python-print/288536#288536">this answer</a>:</p> <pre><code>c...
0
2010-02-25T17:58:53Z
[ "python", "ssh", "stdout" ]
Output of python scripts displayed only at termination when using SSH?
2,336,270
<p>I'm running a script to manage processes on a remote (SSH) machine. Let's call it <strong>five.py</strong></p> <pre><code>#!/usr/bin/python import time, subprocess subprocess.call('echo 0',shell=True) for i in range(1,5): time.sleep(1) print(i) </code></pre> <p>If i now run </p> <pre><code>ssh user@host fi...
4
2010-02-25T17:46:07Z
2,337,591
<p>You can add the -u on the shebang line as interjay hinted</p> <pre><code>#!/usr/bin/python -u </code></pre> <p>You could also reopen stdout with buffering turned off or set to line buffering</p> <pre><code>import os,sys sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) # no buffering sys.stdout = os.fdopen(sys....
5
2010-02-25T21:00:57Z
[ "python", "ssh", "stdout" ]
Output of python scripts displayed only at termination when using SSH?
2,336,270
<p>I'm running a script to manage processes on a remote (SSH) machine. Let's call it <strong>five.py</strong></p> <pre><code>#!/usr/bin/python import time, subprocess subprocess.call('echo 0',shell=True) for i in range(1,5): time.sleep(1) print(i) </code></pre> <p>If i now run </p> <pre><code>ssh user@host fi...
4
2010-02-25T17:46:07Z
2,337,600
<p>One thing you might look at using since you are already using Python is <a href="http://www.lag.net/paramiko/" rel="nofollow">Paramiko</a>, much nicer way to do remote SSH work. Here is an <a href="http://www.vertigrated.com/blog/2010/02/python-remote-ssh-with-paramiko/" rel="nofollow">article</a> about how I am usi...
0
2010-02-25T21:03:03Z
[ "python", "ssh", "stdout" ]
Is it possible to read Fortran formatted data in Python?
2,336,301
<p>I get output files from very old Fortran programs, which look like:</p> <pre><code> 0.81667E+00 -0.12650E+01 -0.69389E-03 0.94381E+00 -0.11985E+01 -0.11502E+00 0.96064E+00 -0.11333E+01 -0.17616E+00 0.10202E+01 -0.12435E+01 -0.93917E-01 0.10026E+01 -0.10904E+01 -0.15108E+00 0.90516E+00 -0.11030E+01 ...
2
2010-02-25T17:50:50Z
2,336,324
<pre><code>Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; float('-0.69389E-03') -0.00069388999999999996 </code></pre>
4
2010-02-25T17:54:06Z
[ "python", "floating-point", "format", "fortran" ]
Is it possible to read Fortran formatted data in Python?
2,336,301
<p>I get output files from very old Fortran programs, which look like:</p> <pre><code> 0.81667E+00 -0.12650E+01 -0.69389E-03 0.94381E+00 -0.11985E+01 -0.11502E+00 0.96064E+00 -0.11333E+01 -0.17616E+00 0.10202E+01 -0.12435E+01 -0.93917E-01 0.10026E+01 -0.10904E+01 -0.15108E+00 0.90516E+00 -0.11030E+01 ...
2
2010-02-25T17:50:50Z
2,336,922
<pre><code>&gt;&gt;&gt; line="0.81667E+00 -0.12650E+01 -0.69389E-03" &gt;&gt;&gt; map(float,line.split()) [0.81667000000000001, -1.2649999999999999, -0.00069388999999999996] </code></pre>
2
2010-02-25T19:24:59Z
[ "python", "floating-point", "format", "fortran" ]
Using eval securely to execute functions
2,336,423
<pre><code>def myFunc(arg1, arg2): print "This is a test with " + arg1 + " and " + arg2 while (input != "quit"): input = raw_input("&gt; ") if input != "quit": eval(input) </code></pre> <p>This code gives me a prompt, allowing me to invoke <code>myFunc</code> with parameters I want. I know that <...
2
2010-02-25T18:06:13Z
2,336,483
<p>This will allow you to use <code>myFunc</code>:</p> <pre><code>eval(input, {"__builtins__": {}, "myFunc": myFunc}) </code></pre> <p>However, as others have pointed out, using <code>eval</code> is inherently insecure, and still vulnerabe to exploits.</p>
1
2010-02-25T18:14:55Z
[ "python", "eval" ]
Using eval securely to execute functions
2,336,423
<pre><code>def myFunc(arg1, arg2): print "This is a test with " + arg1 + " and " + arg2 while (input != "quit"): input = raw_input("&gt; ") if input != "quit": eval(input) </code></pre> <p>This code gives me a prompt, allowing me to invoke <code>myFunc</code> with parameters I want. I know that <...
2
2010-02-25T18:06:13Z
2,337,037
<p>Your question, "How do I fix this without leaving <code>eval</code> open to exploits?", isn't the right one—<code>eval</code> is vulnerable to exploits, period. Not introducing <code>__builtins__</code> into the global namespace of the evaluated code does not make the <code>__builtin__</code> module impossible to ...
1
2010-02-25T19:39:21Z
[ "python", "eval" ]
Using eval securely to execute functions
2,336,423
<pre><code>def myFunc(arg1, arg2): print "This is a test with " + arg1 + " and " + arg2 while (input != "quit"): input = raw_input("&gt; ") if input != "quit": eval(input) </code></pre> <p>This code gives me a prompt, allowing me to invoke <code>myFunc</code> with parameters I want. I know that <...
2
2010-02-25T18:06:13Z
10,964,343
<p>If you need a demonstration of how eval is still dangerous even with the builtins removed, see this: <a href="http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html" rel="nofollow">Eval really is dangerous</a>. There are examples there of segfaulting the CPython interpreter, or of exiting it directly.<...
0
2012-06-09T20:24:49Z
[ "python", "eval" ]
What's the best module to access SimpleDB in python?
2,336,822
<p>I'm writing a python script to select, insert, update, and delete data in SimpleDB.</p> <p>I've been using the simpledb module written by sixapart so far, and it's working pretty well.</p> <p>I've found one potential bug/feature that is problematic for me when running select queries with "limit", and I'm thinking ...
4
2010-02-25T19:10:31Z
2,336,902
<p>I've found boto to be effective and straight forward and I've never had any trouble with queries with limits. Although I've never used the sixapart module. </p>
3
2010-02-25T19:21:59Z
[ "python", "amazon-simpledb" ]
How can I figure out in my module if the main program uses a specific variable?
2,336,868
<p>I know this does not sound Pythonic, but bear with me for a second.</p> <p>I am writing a module that depends on some external closed-source module. That module needs to get instantiated to be used (using module.create()).</p> <p>My module attempts to figure out if my user already loaded that module (easy to do), ...
1
2010-02-25T19:17:52Z
2,336,939
<p>Suppose the external closed-sourced module is called <code>extmod</code>. Create <code>my_extmod.py</code>:</p> <pre><code>import extmod INSTANTIATED=False def create(*args,**kw): global INSTANTIATED INSTANTIATED=True return extmod.create(*args,**kw) </code></pre> <p>Then require your users to import <...
0
2010-02-25T19:27:29Z
[ "python", "global-variables", "python-module" ]
How can I figure out in my module if the main program uses a specific variable?
2,336,868
<p>I know this does not sound Pythonic, but bear with me for a second.</p> <p>I am writing a module that depends on some external closed-source module. That module needs to get instantiated to be used (using module.create()).</p> <p>My module attempts to figure out if my user already loaded that module (easy to do), ...
1
2010-02-25T19:17:52Z
2,337,178
<p>Looks like your code assumes that the <code>.create()</code> function was called, if at all, by the immediate/direct caller of your function (which you show only partially, making it pretty hard to be sure about what's going on) <strong>and</strong> the results placed in a <strong>global</strong> variable (of the mo...
1
2010-02-25T20:00:52Z
[ "python", "global-variables", "python-module" ]
Setting a property from the Pylons .ini file
2,336,878
<p>Let's say I have a <code>settings.py</code> file in my app's root folder (<code>/myapp/myapp/settings.py</code>) with just a bunch of variables in it:</p> <pre><code>var1 = '' var2 = '' </code></pre> <p>Can I automatically set one of those variables from the <code>.ini</code> file? I tried this:</p> <pre><code>my...
0
2010-02-25T19:19:04Z
2,378,529
<p><code>.ini</code> is <strong>one way only</strong> communication. <strong>Django</strong> uses <strong>settings.py</strong> which is a normal python module that can be manipulated on-the-fly (causing many obscure errors). Setup your settings in <code>.ini</code> and use <code>config.get</code> to access variables.</...
0
2010-03-04T10:40:04Z
[ "python", "configuration", "pylons" ]
Setting a property from the Pylons .ini file
2,336,878
<p>Let's say I have a <code>settings.py</code> file in my app's root folder (<code>/myapp/myapp/settings.py</code>) with just a bunch of variables in it:</p> <pre><code>var1 = '' var2 = '' </code></pre> <p>Can I automatically set one of those variables from the <code>.ini</code> file? I tried this:</p> <pre><code>my...
0
2010-02-25T19:19:04Z
6,575,067
<p>You can find relevant information at this page: </p> <p><a href="http://wiki.pylonshq.com/display/pylonscookbook/Getting+Data+from+the+Configuration+File" rel="nofollow">Getting Data from the Configuration File</a></p>
1
2011-07-04T18:43:52Z
[ "python", "configuration", "pylons" ]
Adding Album Art using python in mp3 metadata
2,336,911
<p>The code below doesnt seem to update the artwork of the mp3 file.</p> <p><strong>Code:-</strong></p> <pre><code>#Editing the MetaData tag = eyeD3.Tag() print tag.link('location') //Returns 1 tag.setVersion([2,3,0]) print tag.addImage(0x08,'artwork.jpg') //Return None (Its sure that file is present) print tag.updat...
0
2010-02-25T19:23:45Z
4,055,611
<p>See <a href="http://stackoverflow.com/questions/409949/how-do-you-embed-album-art-into-an-mp3-using-python/4054934#4054934">how to add images (APIC tags)</a>.</p>
0
2010-10-29T20:24:58Z
[ "python", "mp3", "metadata", "id3", "artwork" ]
Adding Album Art using python in mp3 metadata
2,336,911
<p>The code below doesnt seem to update the artwork of the mp3 file.</p> <p><strong>Code:-</strong></p> <pre><code>#Editing the MetaData tag = eyeD3.Tag() print tag.link('location') //Returns 1 tag.setVersion([2,3,0]) print tag.addImage(0x08,'artwork.jpg') //Return None (Its sure that file is present) print tag.updat...
0
2010-02-25T19:23:45Z
4,055,690
<p>It looks like you're specifically referring to adding images to an MP3 using the eyeD3 module. I've only used the CLI version of eyeD3 so I may be wrong, but you don't seem to be passing a type parameter to the addImage method. I don't remember being able to get it to work without passing a type.</p> <blockquote>--...
0
2010-10-29T20:35:10Z
[ "python", "mp3", "metadata", "id3", "artwork" ]
Python Drawing Portion of Image When Mouse Hover
2,336,916
<p>My question relates to Python GTK</p> <p>I have an image -a JPG - which I draw onto a drawing area. I want to reveal a portion of the image -say a 10pix by 10 px square -only where the mouse pointer is currently at. Everything 10 x 10 px square away from the mouse should hidden i.e. black.</p> <p>I'm am new to PyG...
2
2010-02-25T19:24:16Z
2,777,652
<pre><code>#!/usr/bin/python import os import sys import gtk MASK_COLOR = 0x000000 def composite(source, start_x=345, start_y=345): width = 50 height = 50 alpha = 255 ...
2
2010-05-06T00:25:49Z
[ "python", "image-processing", "pygtk" ]
Transaction within transaction
2,336,950
<p>I want to know if open a transaction inside another is safe and encouraged?</p> <p>I have a method:</p> <pre><code>def foo(): session.begin try: stuffs except Exception, e: session.rollback() raise e session.commit() </code></pre> <p>and a method that calls the first on...
6
2010-02-25T19:28:44Z
2,337,059
<p>You can't, PostgreSQL doesn't support subtransactions. You might want to use savepoints, but thats something else.</p>
0
2010-02-25T19:42:16Z
[ "python", "database", "postgresql", "sqlalchemy" ]
Transaction within transaction
2,336,950
<p>I want to know if open a transaction inside another is safe and encouraged?</p> <p>I have a method:</p> <pre><code>def foo(): session.begin try: stuffs except Exception, e: session.rollback() raise e session.commit() </code></pre> <p>and a method that calls the first on...
6
2010-02-25T19:28:44Z
2,337,881
<p>there are two ways two nest transactions in SQLAlchemy. One is virtual transactions, where SQLAlchemy keeps track of how many begin's you have issued and issues the commit only when the outermost transaction commits. The rollback however is issued immediately. Because the transaction is virtual - i.e. the database k...
14
2010-02-25T21:44:35Z
[ "python", "database", "postgresql", "sqlalchemy" ]
Transaction within transaction
2,336,950
<p>I want to know if open a transaction inside another is safe and encouraged?</p> <p>I have a method:</p> <pre><code>def foo(): session.begin try: stuffs except Exception, e: session.rollback() raise e session.commit() </code></pre> <p>and a method that calls the first on...
6
2010-02-25T19:28:44Z
2,339,865
<blockquote> <p>On PostgreSQL nested transactions work just fine.</p> </blockquote> <p>Well, you're not going to get an error (just a warning), that's true. But you can't commit the inner transaction and rollback the outer transaction, the outer transaction will also rollback the inner transaction.</p> <blockquote>...
0
2010-02-26T06:28:19Z
[ "python", "database", "postgresql", "sqlalchemy" ]
How do I pass a list parameter as multiple link-named elements instead of as an array in SOAPpy?
2,336,961
<p>I am trying to pass multiple instances of an element to a web servile that has the following wsdl</p> <pre><code> &lt;complexType name="OAMCommand"&gt; &lt;sequence&gt; &lt;element name="m-strName" type="xsd:string" minOccurs="1" maxOccurs="1"/&gt; &lt;element name="m-argVector" type="xsd:string" minOc...
0
2010-02-25T19:30:53Z
2,418,795
<p>After trying a few different librairies (suds, soaplib), I finally dug into the SOAPpy code.</p> <p>In order to remove the arrays from my SOAP requests, I modified the <strong>dump_list()</strong> function in the <strong>SOAPBuilder</strong> class of the SOAPpy library.</p> <pre><code># COMMENT: We dont want array...
0
2010-03-10T16:56:02Z
[ "python", "soap", "wsdl", "soappy" ]
(How) Can I use string substitution for working w/ Django’s i18n {% trans %} tag?
2,337,077
<p>I'm looking for something like this: </p> <p><code>{% trans "There are %{flowers}n flowers in the vase" &lt; flowers:3 %}</code></p> <p>Now obviously syntax is fake, but it should be sufficient to demonstrate what I'm looking for. </p> <p>Should I cook something of my own? It looks like a common usecase, so I was...
1
2010-02-25T19:44:35Z
2,337,133
<p>Use <a href="http://docs.djangoproject.com/en/1.1/topics/i18n/internationalization/#specifying-translation-strings-in-template-code" rel="nofollow"><code>{% blocktrans %}</code></a> instead of <code>{% trans %}</code>.</p>
1
2010-02-25T19:52:41Z
[ "python", "django", "formatting", "templates", "internationalization" ]
(How) Can I use string substitution for working w/ Django’s i18n {% trans %} tag?
2,337,077
<p>I'm looking for something like this: </p> <p><code>{% trans "There are %{flowers}n flowers in the vase" &lt; flowers:3 %}</code></p> <p>Now obviously syntax is fake, but it should be sufficient to demonstrate what I'm looking for. </p> <p>Should I cook something of my own? It looks like a common usecase, so I was...
1
2010-02-25T19:44:35Z
2,337,134
<p>I'm not absolutely sure what you're trying to do (what's <code>&lt; flowers:3</code> supposed to do?), but have you looked at <a href="http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#specifying-translation-strings-in-template-code" rel="nofollow">blocktrans</a>?</p> <pre><code>{% blocktrans c...
3
2010-02-25T19:52:46Z
[ "python", "django", "formatting", "templates", "internationalization" ]
(How) Can I use string substitution for working w/ Django’s i18n {% trans %} tag?
2,337,077
<p>I'm looking for something like this: </p> <p><code>{% trans "There are %{flowers}n flowers in the vase" &lt; flowers:3 %}</code></p> <p>Now obviously syntax is fake, but it should be sufficient to demonstrate what I'm looking for. </p> <p>Should I cook something of my own? It looks like a common usecase, so I was...
1
2010-02-25T19:44:35Z
3,216,982
<p>You may find the module <a href="http://pypi.python.org/pypi/inflect" rel="nofollow">inflect.py</a> useful, although it would mean departing from the templating system.</p> <pre><code>import inflect p = inflect.engine() p.num(numflowers, show=False) return 'There %s %s %s in the vase.' % ( p.pl('is'),...
0
2010-07-09T22:37:09Z
[ "python", "django", "formatting", "templates", "internationalization" ]
Jython image manipulation
2,337,110
<p>This program is supposed to take the outline of an image, then split it into different quadrants, then color it, such as the Andy Warhol Marilyn Monroe picture. </p> <p>Every function up to the "Warholize" function works but it gets stuck on <code>c=getPixel(picEdge,x,y)</code> under the <code>warholize</code> fun...
5
2010-02-25T19:47:51Z
17,864,427
<p>I put the difference and intensity functions into the makeOutline function. I have called the warholize function from the makeOutline function.<br> Also, you needed to get the colors for the separate quadrants, here, I've just used getRed pixel to see if it is black or white (full color or not).</p> <p>In this case...
9
2013-07-25T17:08:03Z
[ "python", "jython", "image-manipulation", "jes" ]
Grabbing a random frame from a webcam with GStreamer in Python
2,337,147
<p>I'm trying to write a program to control a robot by interpreting frames from a webcam and happened upon GStreamer.</p> <p>I've been able to stream video in Python from the webcam with GStreamer with help from this page: <a href="http://www.ndeschildre.net/2008/04/04/python-power/" rel="nofollow">http://www.ndeschil...
3
2010-02-25T19:54:00Z
2,337,483
<p>Look at the source code for <strong>cheese</strong>, the Gnome photobooth application.</p> <p>You could also try the usersink.</p>
1
2010-02-25T20:45:11Z
[ "python", "webcam", "snapshot", "gstreamer" ]
Grabbing a random frame from a webcam with GStreamer in Python
2,337,147
<p>I'm trying to write a program to control a robot by interpreting frames from a webcam and happened upon GStreamer.</p> <p>I've been able to stream video in Python from the webcam with GStreamer with help from this page: <a href="http://www.ndeschildre.net/2008/04/04/python-power/" rel="nofollow">http://www.ndeschil...
3
2010-02-25T19:54:00Z
2,338,643
<p>I've heard of some success with OpenCV's Python bindings. Here is one of those successes: <a href="http://blog.jozilla.net/2008/06/27/fun-with-python-opencv-and-face-detection/" rel="nofollow">http://blog.jozilla.net/2008/06/27/fun-with-python-opencv-and-face-detection/</a></p>
1
2010-02-26T00:21:04Z
[ "python", "webcam", "snapshot", "gstreamer" ]
How can I listen for a mouse event in Python on Mac?
2,337,196
<p>I need to listen for global mouse events(not bound to an app) on my Mac in an app written in Python.</p> <p>I'm using PyObjC, but I can't figure out how to do it. Plain ObjC examples or other Python techniques also appreciated.</p> <p>My code so far:</p> <pre><code>from Quartz import * def MyFunction(proxy, type,...
9
2010-02-25T20:03:45Z
2,337,498
<p>First, <strong>CGEventTapCreate</strong> and <strong>CGEventTapCreateForPSN</strong> leak some memory when they are called. This is needed to avoid memory management problems. It is therefore advisable not to call these functions, are at least call them a small number of times.</p> <p>Now, a mouse event works somet...
-1
2010-02-25T20:46:49Z
[ "python", "objective-c", "mouseevent", "pyobjc" ]
How can I listen for a mouse event in Python on Mac?
2,337,196
<p>I need to listen for global mouse events(not bound to an app) on my Mac in an app written in Python.</p> <p>I'm using PyObjC, but I can't figure out how to do it. Plain ObjC examples or other Python techniques also appreciated.</p> <p>My code so far:</p> <pre><code>from Quartz import * def MyFunction(proxy, type,...
9
2010-02-25T20:03:45Z
2,395,052
<p>The documentation for <strong>CGEventTapCreate</strong> (http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventTapCreate) says that you need to be root to use kCGHIDEventTap. Are you running your script as root? (sudo is one wa...
1
2010-03-07T03:26:59Z
[ "python", "objective-c", "mouseevent", "pyobjc" ]
How can I listen for a mouse event in Python on Mac?
2,337,196
<p>I need to listen for global mouse events(not bound to an app) on my Mac in an app written in Python.</p> <p>I'm using PyObjC, but I can't figure out how to do it. Plain ObjC examples or other Python techniques also appreciated.</p> <p>My code so far:</p> <pre><code>from Quartz import * def MyFunction(proxy, type,...
9
2010-02-25T20:03:45Z
4,481,558
<p>The fourth parameter of CGEventTapCreate is <code>CGEventMask eventsOfInterest</code>, and you gave it <code>kCGEventLeftMouseDown</code> which is an enum of type <code>_CGEventType</code>. Instead of the integer constant, you need to flip the appropriate bit in the bitmask. You can do this using <code>CGEventMaskBi...
2
2010-12-19T04:17:04Z
[ "python", "objective-c", "mouseevent", "pyobjc" ]
Any way of achieving the same thing as python -mpdb from inside the script?
2,337,216
<p>Besides wrapping all your code in <code>try</code> <code>except</code>, is there any way of achieving the same thing as running your script like <code>python -mpdb script</code>? I'd like to be able to see what went wrong when an exception gets raised.</p>
1
2010-02-25T20:06:11Z
2,337,299
<p><code>import pdb; pdb.set_trace()</code></p> <p>Source: <a href="http://docs.python.org/library/pdb.html" rel="nofollow">http://docs.python.org/library/pdb.html</a></p>
0
2010-02-25T20:18:08Z
[ "python", "debugging", "pdb" ]
Any way of achieving the same thing as python -mpdb from inside the script?
2,337,216
<p>Besides wrapping all your code in <code>try</code> <code>except</code>, is there any way of achieving the same thing as running your script like <code>python -mpdb script</code>? I'd like to be able to see what went wrong when an exception gets raised.</p>
1
2010-02-25T20:06:11Z
2,337,349
<p>If you do not want to modify the source then yOu could run it from <a href="http://ipython.scipy.org/moin/" rel="nofollow">ipython</a> - an enhanced interactive python shell.</p> <p>e.g. run ipython then execute <code>%pdb on</code> to enable post-mortem debugging. <code>%run scriptname</code> will then run the sc...
3
2010-02-25T20:23:35Z
[ "python", "debugging", "pdb" ]
Any way of achieving the same thing as python -mpdb from inside the script?
2,337,216
<p>Besides wrapping all your code in <code>try</code> <code>except</code>, is there any way of achieving the same thing as running your script like <code>python -mpdb script</code>? I'd like to be able to see what went wrong when an exception gets raised.</p>
1
2010-02-25T20:06:11Z
2,339,516
<pre><code>python -i script </code></pre> <p>will leave you in the interactive shell when an exception gets raised; then</p> <pre><code>import pdb pdb.pm() </code></pre> <p>will put you into the post-mortem debugger so you can do all the usual debugging things.</p> <p>This should work as long as your script does no...
1
2010-02-26T04:30:49Z
[ "python", "debugging", "pdb" ]
Is it a bad idea to change the app_label assignment on existing Django models?
2,337,259
<p>I have the hair-brained idea of grouping models from different existing apps into one big new shiny app. There's not a super important reason I need to do this, but it would be nice to consolidate all of the code in one subdirectory and it would improve the site to group all the models together in the admin_index un...
1
2010-02-25T20:13:06Z
2,337,669
<p>You're correct that moving models around would render existing ContentType entries useless. Without knowing the specifics of your project it's hard to say what might be a "good idea". You might just try branching your code, making the changes, and updating the content types and permissions tables to reflect. Alterna...
0
2010-02-25T21:15:57Z
[ "python", "django", "templates", "models", "admin" ]
Set a DTD using minidom in python
2,337,285
<p>I am trying to include a reference to a DTD in my XML doc using minidom. </p> <p>I am creating the document like:</p> <pre><code>doc = Document() foo = doc.createElement('foo') doc.appendChild(foo) doc.toxml() </code></pre> <p>This gives me:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;foo/&gt; </code></pre> ...
4
2010-02-25T20:16:35Z
2,337,678
<p>According to <a href="http://docs.python.org/library/xml.dom.minidom.html#minidom-and-the-dom-standard" rel="nofollow">the Python docs</a>, there is no implementation of the DocumentType interface in the minidom.</p>
1
2010-02-25T21:17:27Z
[ "python", "xml", "dtd", "minidom" ]
Set a DTD using minidom in python
2,337,285
<p>I am trying to include a reference to a DTD in my XML doc using minidom. </p> <p>I am creating the document like:</p> <pre><code>doc = Document() foo = doc.createElement('foo') doc.appendChild(foo) doc.toxml() </code></pre> <p>This gives me:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;foo/&gt; </code></pre> ...
4
2010-02-25T20:16:35Z
2,340,579
<p>The documentation is out of date. Use the source, Luke. I do it something like this.</p> <pre><code>from xml.dom.minidom import DOMImplementation imp = DOMImplementation() doctype = imp.createDocumentType( qualifiedName='foo', publicId='', systemId='http://www.path.to.my.dtd.com/my.dtd', ) doc = imp.c...
7
2010-02-26T09:32:44Z
[ "python", "xml", "dtd", "minidom" ]
Convert SQL query to Django friendly format for application
2,337,333
<p>I have an SQL query thats runs on the Postgres database of my Django based webapp. The query runs against the data stored by Django-Notifications (a reusable app) and returns a list of email addresses that have not opted out of a specific notice type. </p> <p>What I would really like to be able to do is to build an...
0
2010-02-25T20:21:25Z
2,337,435
<p>You might have to make appropriate adjustments as far as model names go, since you didn't show them in your question:</p> <pre><code>users_to_exclude = Noticesetting.objects.filter(send=False, notice_type__label='announcement').values('user') emails = Emailaddress.objects.exclude(user__in=users_to_exclude) </code><...
1
2010-02-25T20:36:31Z
[ "python", "sql", "django", "django-models" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,705
<p>I would say, "use <code>xrange()</code> instead", but you are actually using the list of ints as the sieve result..... So an integer generator is not a correct solution.</p> <p>I think it will be difficult to materialize a list with 39312312323123123 elements in it, no matter what function you use to do so.... Tha...
6
2010-02-25T21:22:18Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,745
<p><code>range()</code> returns a list containing all the numbers in the requested range, while <code>xrange</code> is a generator and yields the numbers one after another with a memory consumption close to zero. </p>
0
2010-02-25T21:27:04Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,762
<p>Your algorithm is broken. Get it to work for maxnum=100 first.</p> <p>Once you get it working you will find maxnum=100000000 will takes a long long time to run.</p> <p>Plot the time it takes to run for maxnum in (10,100,1000,10000,100000,1000000...) you may be able to extrapolate how long 39312312323123123 will ta...
2
2010-02-25T21:29:15Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,857
<p>About the memory limit, how about creating a custom list (class) that internally is a linked list of lists or arrays. Magically traverse from one to the other internally, and add more as needed, as the caller uses your custom list with the external interface you've provided which will be similar to those members nee...
0
2010-02-25T21:40:03Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,867
<p>There is a third party module for python called <code>gmpy</code></p> <p>It has a couple of functions that may be useful to you as they are very fast. The probabilistic stuff kicks in around the 4 billion mark.</p> <pre><code>next_prime(...) next_prime(x): returns the smallest prime number &gt; x. Note that ...
1
2010-02-25T21:41:50Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,900
<p>It's a more complex algorithm, perhaps technically not counting as the sieve, but one approach is to not remove all multiples of a given prime at once, but queue the next multiple (along with the prime). This could be used in a generator implementation. The queue will still end up containing a lot of (multiples of) ...
2
2010-02-25T21:47:46Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Exceeding the size of lists in python
2,337,700
<p>I'm trying to implement the <a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow" title="Sieve of Eratosthenes">sieve of eratosthenes</a> in python, however when trying to find all primes up to the sqare root of for instance <a href="http://www.wolframalpha.com/input/?i=779695003923747564589111...
4
2010-02-25T21:21:05Z
2,337,954
<p>Try this:</p> <pre><code>def getPrimes(maxnum): primes = [] for i in xrange(2, maxnum): is_mul = False for j in primes: # Try dividing by all previous primes if i % j == 0: is_mul = True # Once we find a prime that i is divisible by brea...
0
2010-02-25T21:56:56Z
[ "python", "memory", "prime-factoring", "sieve-of-eratosthenes" ]
Requesting advice on persisting objects from a dynamic language to a document database
2,337,819
<p>Do you have any insights into the most elegant way of persisting objects from a dynamic language in a document database?</p> <p>I have a solid background in C# and have just started programming in Python. At the same time I am trying to learn the ropes of MongoDB. </p> <p>Now I am wondering: what is the most elega...
0
2010-02-25T21:35:54Z
2,338,137
<p>Python defines several special methods such as <a href="http://docs.python.org/library/pickle.html?highlight=__getstate__#object.__getstate__" rel="nofollow"><strong>getstate</strong></a> and many others to allow your classes to define exactly how best to serialize and de-serialize their instances. They're all used...
1
2010-02-25T22:25:54Z
[ "python", "orm", "mongodb", "nosql", "dynamic-languages" ]
python, hash function selection
2,337,825
<p>Using Python and Django, I will let my users to give pdf based gifts to their friends, which the said friend will be able to claim pdf by entering to my site from the emailed link.</p> <p>Here is the plan</p> <ol> <li><p>User gives a gives to his friend, enters friends email</p></li> <li><p>In the background, a gi...
1
2010-02-25T21:36:14Z
2,337,861
<p>It may not do things exactly the way you wish, but this project would be a good starting point:</p> <p><a href="http://github.com/mogga/django-token-auth/" rel="nofollow">http://github.com/mogga/django-token-auth/</a></p>
0
2010-02-25T21:40:30Z
[ "python", "django", "hash", "hashcode" ]
python, hash function selection
2,337,825
<p>Using Python and Django, I will let my users to give pdf based gifts to their friends, which the said friend will be able to claim pdf by entering to my site from the emailed link.</p> <p>Here is the plan</p> <ol> <li><p>User gives a gives to his friend, enters friends email</p></li> <li><p>In the background, a gi...
1
2010-02-25T21:36:14Z
2,337,894
<p>There is no need to use a hash, you just need a random token.</p> <ol> <li>Create a string of random characters </li> <li>If it is already used ( unlikely ) repeat step 1</li> </ol> <p>Make the string of characters long enough that you are happy it will be hard to guess </p> <p>an easy way to generate a random s...
6
2010-02-25T21:46:57Z
[ "python", "django", "hash", "hashcode" ]
python, hash function selection
2,337,825
<p>Using Python and Django, I will let my users to give pdf based gifts to their friends, which the said friend will be able to claim pdf by entering to my site from the emailed link.</p> <p>Here is the plan</p> <ol> <li><p>User gives a gives to his friend, enters friends email</p></li> <li><p>In the background, a gi...
1
2010-02-25T21:36:14Z
2,338,461
<p>UUIDs are pretty random</p> <pre><code>In [13]: import uuid In [14]: uuid.uuid4().hex Out[14]: 'f7a7667e94574e32b3589f84ca35a98d' </code></pre>
1
2010-02-25T23:35:10Z
[ "python", "django", "hash", "hashcode" ]
Pickling array.array in 2.4 using cPickle
2,338,001
<p>I am working on a project built on python 2.4 (It is an embedded python project, so I don't have a choice on the version of python used). Throughout the application, we use <code>array.array</code> to store data.</p> <p>Support for pickling <code>array.array</code> objects was added to <code>pickle</code> (and <co...
2
2010-02-25T22:04:26Z
2,338,141
<p>I'm not sure if the array type can be augmented with a <code>__reduce__</code> method (perhaps with a subclass), but you could always try converting your arrays to sequences &amp; back again... if the built-in extension mechanism won't work for you. (hack)</p> <p>I haven't tried this before, but you could try addin...
1
2010-02-25T22:26:28Z
[ "python", "pickle", "monkeypatching", "python-2.4" ]
Pickling array.array in 2.4 using cPickle
2,338,001
<p>I am working on a project built on python 2.4 (It is an embedded python project, so I don't have a choice on the version of python used). Throughout the application, we use <code>array.array</code> to store data.</p> <p>Support for pickling <code>array.array</code> objects was added to <code>pickle</code> (and <co...
2
2010-02-25T22:04:26Z
2,338,159
<p>You can use the standard library module <a href="http://docs.python.org/library/copy_reg.html?highlight=copyreg" rel="nofollow">copy_reg</a> to register functions to deal with pickling instances of types that don't natively support pickling; <code>cPickle</code> will use your registered functions where needed. I'd ...
2
2010-02-25T22:28:41Z
[ "python", "pickle", "monkeypatching", "python-2.4" ]
Pickling array.array in 2.4 using cPickle
2,338,001
<p>I am working on a project built on python 2.4 (It is an embedded python project, so I don't have a choice on the version of python used). Throughout the application, we use <code>array.array</code> to store data.</p> <p>Support for pickling <code>array.array</code> objects was added to <code>pickle</code> (and <co...
2
2010-02-25T22:04:26Z
2,338,186
<p>Looks like you can pickle them, but you can't unpickle the result</p> <pre><code>Python 2.4.5 (#2, Jan 21 2010, 20:05:55) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import cPickle as pickle &gt;&gt;&gt; import array &gt;&gt;&gt;...
1
2010-02-25T22:34:14Z
[ "python", "pickle", "monkeypatching", "python-2.4" ]
Python/Django polling of database has memory leak
2,338,041
<p>I've got a Python script running Django for database and memcache, but it's notably runnning as a standalone daemon (i.e. not responding to webserver requests). The daemon checks a Django model Requisition for objects with a <code>status=STATUS_NEW</code>, then marks them STATUS_WORKING and puts them into a queue.</...
12
2010-02-25T22:08:13Z
2,338,236
<p>Does the settings.py file for the daemon process have <code>DEBUG = True</code>? If so, Django keeps in memory a record of all the SQL it has run so far, which can lead to a memory leak.</p>
5
2010-02-25T22:44:09Z
[ "python", "django", "memory-leaks", "daemon" ]
Python/Django polling of database has memory leak
2,338,041
<p>I've got a Python script running Django for database and memcache, but it's notably runnning as a standalone daemon (i.e. not responding to webserver requests). The daemon checks a Django model Requisition for objects with a <code>status=STATUS_NEW</code>, then marks them STATUS_WORKING and puts them into a queue.</...
12
2010-02-25T22:08:13Z
2,338,335
<p>You need to regularly reset a list of queries that Django keeps for debugging purposes. Normally it is cleared after every request, but since your application is not request based, you need to do this manually:</p> <pre><code>from django import db db.reset_queries() </code></pre> <hr> <p>See also:</p> <ul> <li>...
31
2010-02-25T23:05:38Z
[ "python", "django", "memory-leaks", "daemon" ]
Python/Django polling of database has memory leak
2,338,041
<p>I've got a Python script running Django for database and memcache, but it's notably runnning as a standalone daemon (i.e. not responding to webserver requests). The daemon checks a Django model Requisition for objects with a <code>status=STATUS_NEW</code>, then marks them STATUS_WORKING and puts them into a queue.</...
12
2010-02-25T22:08:13Z
5,267,584
<p>Apart from db.reset_queries() and DEBUG = False tricks, here is another approach: Just spawn another process that performs the django query and feeds the queue. This process will work in its own memory context, and after performing your task it will release back your memory.</p> <p>I believe that sometimes (if not ...
1
2011-03-11T00:19:57Z
[ "python", "django", "memory-leaks", "daemon" ]
Python/Django polling of database has memory leak
2,338,041
<p>I've got a Python script running Django for database and memcache, but it's notably runnning as a standalone daemon (i.e. not responding to webserver requests). The daemon checks a Django model Requisition for objects with a <code>status=STATUS_NEW</code>, then marks them STATUS_WORKING and puts them into a queue.</...
12
2010-02-25T22:08:13Z
18,855,695
<p>I had a lot of data crunching to do, so, my solution to this issue was using multiprocessing, and using pools to counteract whatever memory bloat was happening.</p> <p>To keep it simple, I just defined some "global" (top-level, whatever the term is in Python) functions instead of trying to make things pickle-able.<...
2
2013-09-17T17:01:38Z
[ "python", "django", "memory-leaks", "daemon" ]
In SciPy, using ix_() with sparse matrices doesn't seem to work so what else can I use?
2,338,260
<p>In Numpy, ix_() is used to grab rows and columns of a matrix, but it doesn't seem to work with sparse matrices. For instance, this code works because it uses a dense matrix:</p> <pre><code>&gt;&gt;&gt; import numpy as np &gt;&gt;&gt; x = np.mat([[1,0,3],[0,4,5],[7,8,0]]) &gt;&gt;&gt; print x [[1 0 3] [0 4 5] [7 8...
2
2010-02-25T22:48:42Z
2,338,477
<p>Try this instead:</p> <pre><code>&gt;&gt;&gt; print xspar (0, 0) 1 (0, 2) 3 (1, 1) 4 (1, 2) 5 (2, 0) 7 (2, 1) 8 &gt;&gt;&gt; print xspar[[[0],[2]],[0,2]] (0, 0) 1 (0, 2) 3 (2, 0) 7 </code></pre> <p>Note the difference with this:</p> <pre><code>&gt;&gt;&gt; print xspar[[0,2],[0,2]] [[1 0]] </co...
2
2010-02-25T23:38:24Z
[ "python", "indexing", "numpy", "scipy", "sparse-matrix" ]
QSqlTableModel, data function overload
2,338,276
<p>I'm trying to inherit QSqlTableModel to make data im my table display in way i need.</p> <pre><code>class TableViewModel(QSqlTableModel): def __init__(self): super(TableViewModel, self).__init__() def flags(self, modelIndex): if not modelIndex.isValid(): return if mode...
1
2010-02-25T22:53:34Z
2,339,072
<p>I'm not sure what that <code>record.value</code> is supposed to be (no indication in your code of where that <code>record</code> variable lives or how or when it's set). Anyway, for "getting data from QSqlTableModel" (whereby I assume you mean the base class you're subclassing), use</p> <pre><code>whatever = QSqlT...
2
2010-02-26T02:13:15Z
[ "python", "pyqt" ]
How to use Corba with Python
2,338,331
<p>I'm wondering if anyone have a good resource for working with Corba in Python? I've googled around and saw that fnorb was recommended by some, but that it doesn't support some new features in Corba. Omniorb seemed like a good alternative, but I have no idea how to use it with Python (not fnorb either).</p> <p>Any a...
8
2010-02-25T23:04:48Z
2,378,881
<p>What's wrong with the omniORBpy <a href="http://omniorb.sourceforge.net/omnipy3/omniORBpy/">User's Guide</a> ?</p>
9
2010-03-04T11:34:39Z
[ "python", "corba" ]
Python sorting - A list of objects
2,338,531
<p>I'd like to use the somelist.sort() method to do this if possible.</p> <p>I have a list containing objects, all objects have a member variable resultType that is an integer. I'd like to sort the list using this number.</p> <p>How do I do this?</p> <p>Thanks!</p>
26
2010-02-25T23:55:48Z
2,338,540
<pre><code>somelist.sort(key = lambda x: x.resultType) </code></pre> <p>Here's another way to do the same thing that you will often see used:</p> <pre><code>import operator s.sort(key = operator.attrgetter('resultType')) </code></pre> <p>You might also want to look at <a href="http://docs.python.org/library/function...
49
2010-02-25T23:59:13Z
[ "python", "list", "sorting" ]
Python sorting - A list of objects
2,338,531
<p>I'd like to use the somelist.sort() method to do this if possible.</p> <p>I have a list containing objects, all objects have a member variable resultType that is an integer. I'd like to sort the list using this number.</p> <p>How do I do this?</p> <p>Thanks!</p>
26
2010-02-25T23:55:48Z
2,338,567
<p>Of course, it doesn't have to be a lambda. Any function passed in, such as the below one, will work</p> <pre><code>def numeric_compare(x, y): if x &gt; y: return 1 elif x == y: return 0 else: #x &lt; y return -1 a = [5, 2, 3, 1, 4] a.sort(numeric_compare) </code></pre> <p>Source : <a h...
8
2010-02-26T00:03:11Z
[ "python", "list", "sorting" ]
Python sorting - A list of objects
2,338,531
<p>I'd like to use the somelist.sort() method to do this if possible.</p> <p>I have a list containing objects, all objects have a member variable resultType that is an integer. I'd like to sort the list using this number.</p> <p>How do I do this?</p> <p>Thanks!</p>
26
2010-02-25T23:55:48Z
2,338,695
<pre><code>somelist.sort(cmp = lambda x, y: cmp(x.resultType, y.resultType)) </code></pre> <p>Is better than:</p> <pre><code>somelist.sort(key = lambda x: x.resultType) </code></pre> <p>In the first case we pass in a comparison function which is used to pair-wise compare the elements in the list. In the second case ...
1
2010-02-26T00:31:29Z
[ "python", "list", "sorting" ]
parse xhtml in python 2.6
2,338,533
<p>xml.etree.ElementTree.parse is choking on my xhtml file. I saw somewhere that lxml can handle html. Can someone tell me the documented way to parse, and then alter, xhtml? I want to add some javascript to xhtml on the fly.</p>
1
2010-02-25T23:56:23Z
2,338,555
<p>Have you tried <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">BeautifulSoup</a>? It handles documents that aren't well formed and I've found it pretty good.</p>
3
2010-02-26T00:01:18Z
[ "python", "xhtml" ]
How can I run a py2exe program in windows without the terminal?
2,338,951
<p>Could someone explain to me how can I run my py2exe program, a console program, without the terminal on Windows?</p> <p>I'm trying to make a program that re-sizes windows and it supposed to start with windows, so I want it hide out but still running...</p>
6
2010-02-26T01:32:18Z
2,338,955
<p>Use the <code>setup()</code> function like this:</p> <p><code>setup(windows=['myfile.py'])</code></p> <p>See the <a href="http://www.py2exe.org/index.cgi/ListOfOptions" rel="nofollow">list of options</a> for <code>setup()</code>.</p>
4
2010-02-26T01:35:10Z
[ "python", "windows", "py2exe" ]
How can I run a py2exe program in windows without the terminal?
2,338,951
<p>Could someone explain to me how can I run my py2exe program, a console program, without the terminal on Windows?</p> <p>I'm trying to make a program that re-sizes windows and it supposed to start with windows, so I want it hide out but still running...</p>
6
2010-02-26T01:32:18Z
2,338,973
<p>Not really understand your requirement, but you can try <code>start /MIN</code>. type <code>start /?</code> on the command line to see its help page.</p>
0
2010-02-26T01:40:16Z
[ "python", "windows", "py2exe" ]
How can I run a py2exe program in windows without the terminal?
2,338,951
<p>Could someone explain to me how can I run my py2exe program, a console program, without the terminal on Windows?</p> <p>I'm trying to make a program that re-sizes windows and it supposed to start with windows, so I want it hide out but still running...</p>
6
2010-02-26T01:32:18Z
2,338,976
<p>Would you consider compiling it into an EXE (using <a href="http://www.py2exe.org/" rel="nofollow">py2exe</a> or some such) and adding it to your list of startup programs?</p>
0
2010-02-26T01:40:34Z
[ "python", "windows", "py2exe" ]
How can I run a py2exe program in windows without the terminal?
2,338,951
<p>Could someone explain to me how can I run my py2exe program, a console program, without the terminal on Windows?</p> <p>I'm trying to make a program that re-sizes windows and it supposed to start with windows, so I want it hide out but still running...</p>
6
2010-02-26T01:32:18Z
2,339,423
<p>Sounds like what you want is for your script to run as a Windows Service instead of a Windows program. Something like this tutorial might be helpful: </p> <p><a href="http://islascruz.org/html/index.php?gadget=StaticPage&amp;action=Page&amp;id=6" rel="nofollow">http://islascruz.org/html/index.php?gadget=StaticPage&...
0
2010-02-26T04:02:53Z
[ "python", "windows", "py2exe" ]
How can I make my program execute a function from a keyboard shortcut?
2,339,165
<p>How can I do it, even if my application.exe is not the focused window ?</p> <p>For example, like the <kbd>Windows</kbd>+<kbd>D</kbd> shortcut... Works everywhere...</p> <p>I want that <kbd>ALT</kbd>+<kbd>1</kbd> does a function, <kbd>ALT</kbd>+<kbd>2</kbd> does another one, and so on...</p>
1
2010-02-26T02:34:09Z
2,339,185
<p>You mean like <a href="http://timgolden.me.uk/python/win32_how_do_i/catch_system_wide_hotkeys.html" rel="nofollow">this?</a></p>
2
2010-02-26T02:41:35Z
[ "python", "keyboard", "shortcut" ]
How can I make my program execute a function from a keyboard shortcut?
2,339,165
<p>How can I do it, even if my application.exe is not the focused window ?</p> <p>For example, like the <kbd>Windows</kbd>+<kbd>D</kbd> shortcut... Works everywhere...</p> <p>I want that <kbd>ALT</kbd>+<kbd>1</kbd> does a function, <kbd>ALT</kbd>+<kbd>2</kbd> does another one, and so on...</p>
1
2010-02-26T02:34:09Z
2,339,187
<p>You need to use <a href="http://mindtrove.info/articles/monitoring-global-input-with-pyhook/" rel="nofollow">pyHook</a>.</p>
1
2010-02-26T02:41:59Z
[ "python", "keyboard", "shortcut" ]
How can I make my program execute a function from a keyboard shortcut?
2,339,165
<p>How can I do it, even if my application.exe is not the focused window ?</p> <p>For example, like the <kbd>Windows</kbd>+<kbd>D</kbd> shortcut... Works everywhere...</p> <p>I want that <kbd>ALT</kbd>+<kbd>1</kbd> does a function, <kbd>ALT</kbd>+<kbd>2</kbd> does another one, and so on...</p>
1
2010-02-26T02:34:09Z
7,479,502
<p>I have a pyHook example on my site. <a href="http://fadedbluesky.com/2011/using-pyhook-to-block-windows-key/" rel="nofollow">http://fadedbluesky.com/2011/using-pyhook-to-block-windows-key/</a></p> <p>I originally wrote this to block keys in a game written using pygame. You should be able to easily adapt it to othe...
1
2011-09-20T02:42:18Z
[ "python", "keyboard", "shortcut" ]
How can I order elements in this case? - Django
2,339,203
<p>So I have a list of models, don't think the structure of these models is important. In this case Articles.</p> <hr> <p>So these Articles are ordered by popularity between a rank of 1 to 100, all the other articles have no ranks.</p> <p>Whenever I update the rank of a model the model with equivalent rank must loos...
0
2010-02-26T02:48:09Z
2,339,239
<p>Do you mean something like this?</p> <pre><code>def update_rank(rank, article): old = Article.object.get(rank=rank) old.rank = None old.save() article.rank = rank article.save() </code></pre>
1
2010-02-26T03:02:45Z
[ "python", "django", "django-models" ]
Workaround for python 2.4's yield not allowed in try block with finally clause
2,339,358
<p>I'm stuck on python2.4, so I can't use a finally clause with generators or <code>yield</code>. Is there any way to work around this?</p> <p>I can't find any mentions of how to work around this limitation in python 2.4, and I'm not a big fan of the workarounds I've thought of (mainly involving <code>__del__</code> ...
4
2010-02-26T03:45:59Z
2,339,437
<p>You can duplicate code to avoid the finally block:</p> <pre><code>try: yield 42 finally: do_something() </code></pre> <p>Becomes:</p> <pre><code>try: yield 42 except: # bare except, catches *anything* do_something() raise # re-raise same exception do_something() </code></pre> <p>(I've not tried this ...
4
2010-02-26T04:08:59Z
[ "python", "yield", "python-2.4", "try-finally" ]
Workaround for python 2.4's yield not allowed in try block with finally clause
2,339,358
<p>I'm stuck on python2.4, so I can't use a finally clause with generators or <code>yield</code>. Is there any way to work around this?</p> <p>I can't find any mentions of how to work around this limitation in python 2.4, and I'm not a big fan of the workarounds I've thought of (mainly involving <code>__del__</code> ...
4
2010-02-26T03:45:59Z
2,339,860
<p>The only code that's guaranteed to be called when a generator instance is simply abandoned (garbage collected) are the <code>__del__</code> methods for its local variables (if no references to those objects exist outside) and the callbacks for weak references to its local variables (ditto). I recommend the weak ref...
2
2010-02-26T06:27:09Z
[ "python", "yield", "python-2.4", "try-finally" ]
Python - pyparsing unicode characters
2,339,386
<p>:) I tried using w = Word(printables), but it isn't working. How should I give the spec for this. 'w' is meant to process Hindi characters (UTF-8)</p> <p>The code specifies the grammar and parses accordingly. </p> <pre><code>671.assess :: अहसास ::2 x=number + "." + src + "::" + w + "::" + number + "." ...
10
2010-02-26T03:52:11Z
2,339,801
<p>As a general rule, do <strong>not</strong> process encoded bytestrings: make them into proper unicode strings (by calling their <code>.decode</code> method) as soon as possible, do all of your processing always on unicode strings, then, if you have to for I/O purposes, <code>.encode</code> them back into whatever by...
6
2010-02-26T06:08:08Z
[ "python", "unicode", "nlp", "pyparsing" ]
Python - pyparsing unicode characters
2,339,386
<p>:) I tried using w = Word(printables), but it isn't working. How should I give the spec for this. 'w' is meant to process Hindi characters (UTF-8)</p> <p>The code specifies the grammar and parses accordingly. </p> <pre><code>671.assess :: अहसास ::2 x=number + "." + src + "::" + w + "::" + number + "." ...
10
2010-02-26T03:52:11Z
2,340,659
<p>Pyparsing's <code>printables</code> only deals with strings in the ASCII range of characters. You want printables in the full Unicode range, like this:</p> <pre><code>unicodePrintables = u''.join(unichr(c) for c in xrange(sys.maxunicode) if not unichr(c).isspace()) </code><...
17
2010-02-26T09:43:50Z
[ "python", "unicode", "nlp", "pyparsing" ]
How can I make URLs in Django similar to stackoverflow?
2,339,436
<p>I'm creating a video site. I want my direct urls to a video to look like example.com/watch/this-is-a-slug-1 where 1 is the video id. I don't want the slug to matter though. example.com/watch/this-is-another-slug-1 should point to the same page. On SO, /questions/id is the only part of the url that matters. How can I...
5
2010-02-26T04:08:36Z
2,339,466
<p>Stack Overflow uses the form</p> <pre><code>example.com/watch/1/this-is-a-slug </code></pre> <p>which is easier to handle. You're opening a can of worms if you want the ID to be at the end of the slug token, since then it'll (for example) restrict what kinds of slugs you can use, or just make it harder on yourself...
8
2010-02-26T04:15:34Z
[ "python", "django", "url", "friendly-url", "slug" ]
How can I make URLs in Django similar to stackoverflow?
2,339,436
<p>I'm creating a video site. I want my direct urls to a video to look like example.com/watch/this-is-a-slug-1 where 1 is the video id. I don't want the slug to matter though. example.com/watch/this-is-another-slug-1 should point to the same page. On SO, /questions/id is the only part of the url that matters. How can I...
5
2010-02-26T04:08:36Z
2,340,258
<p>With all due respect to Stackoverflow, this is the wrong way to do it. You shouldn't need to have two elements in the URL that identify the page. The ID is irrelevant - it's junk. You should be able to uniquely identify a page from the slug alone.</p>
-3
2010-02-26T08:13:59Z
[ "python", "django", "url", "friendly-url", "slug" ]
How can I make URLs in Django similar to stackoverflow?
2,339,436
<p>I'm creating a video site. I want my direct urls to a video to look like example.com/watch/this-is-a-slug-1 where 1 is the video id. I don't want the slug to matter though. example.com/watch/this-is-another-slug-1 should point to the same page. On SO, /questions/id is the only part of the url that matters. How can I...
5
2010-02-26T04:08:36Z
2,340,365
<p>I haven't used Django but I've used MVC frameworks before. Generally they have some sort of URL routing feature that lets you define a pattern (usually a regular expression) which gets mapped to a controller.</p> <p>This might be a good place to start: <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/...
0
2010-02-26T08:36:57Z
[ "python", "django", "url", "friendly-url", "slug" ]
reading a os.popen(command) into a string
2,339,469
<p>I'm not to sure if my title is right. What I'm doing is writing a python script to automate some of my code writing. So I'm parsing through a .h file. but I want to expand all macros before I start. so I want to do a call to the shell to:</p> <pre><code>gcc -E myHeader.h </code></pre> <p>Which should out put the p...
11
2010-02-26T04:17:42Z
2,339,494
<p>The <code>os.popen</code> function just returns a file-like object. You can use it like so:</p> <pre><code>import os process = os.popen('gcc -E myHeader.h') preprocessed = process.read() process.close() </code></pre> <p>As others have said, you should be using <code>subprocess.Popen</code>. It's designed to be a ...
17
2010-02-26T04:26:01Z
[ "python", "string", "popen" ]
reading a os.popen(command) into a string
2,339,469
<p>I'm not to sure if my title is right. What I'm doing is writing a python script to automate some of my code writing. So I'm parsing through a .h file. but I want to expand all macros before I start. so I want to do a call to the shell to:</p> <pre><code>gcc -E myHeader.h </code></pre> <p>Which should out put the p...
11
2010-02-26T04:17:42Z
2,339,502
<p>you should use <code>subprocess.Popen()</code> there are numerous examples on SO</p> <p><a href="http://stackoverflow.com/questions/1388753/how-to-get-output-from-subprocess-popen">http://stackoverflow.com/questions/1388753/how-to-get-output-from-subprocess-popen</a></p>
5
2010-02-26T04:27:51Z
[ "python", "string", "popen" ]
reading a os.popen(command) into a string
2,339,469
<p>I'm not to sure if my title is right. What I'm doing is writing a python script to automate some of my code writing. So I'm parsing through a .h file. but I want to expand all macros before I start. so I want to do a call to the shell to:</p> <pre><code>gcc -E myHeader.h </code></pre> <p>Which should out put the p...
11
2010-02-26T04:17:42Z
2,339,788
<pre><code>import subprocess p = subprocess.popen('gcc -E myHeader.h'.split(), stdout=subprocess.PIPE) preprocessed, _ = p.communicate() </code></pre> <p>String <code>preprocessed</code> now has the preprocessed source you require -- and you've used the "right" (modern) way to shell to a subproce...
11
2010-02-26T06:03:23Z
[ "python", "string", "popen" ]
reading a os.popen(command) into a string
2,339,469
<p>I'm not to sure if my title is right. What I'm doing is writing a python script to automate some of my code writing. So I'm parsing through a .h file. but I want to expand all macros before I start. so I want to do a call to the shell to:</p> <pre><code>gcc -E myHeader.h </code></pre> <p>Which should out put the p...
11
2010-02-26T04:17:42Z
16,266,645
<p>The <em>os.popen()</em> has been deprecated since Python 2.6. You should now use the <em>subprocess</em> module instead: <a href="http://docs.python.org/2/library/subprocess.html#subprocess.Popen" rel="nofollow">http://docs.python.org/2/library/subprocess.html#subprocess.Popen</a></p> <pre><code>import subprocess ...
2
2013-04-28T19:07:58Z
[ "python", "string", "popen" ]
music visualization error with gstreamer
2,339,512
<p>hi I am trying to visualize a music file in gstreamer using the following command:</p> <pre><code>gst-launch filesrc location=file.mp3 ! decodebin ! audioconvert ! tee name=myT myT. ! queue ! autoaudiosink myT. ! queue ! goom ! colorspace ! autovideosink </code></pre> <p>But I get this error : "There may be a ti...
1
2010-02-26T04:29:39Z
2,341,524
<p>I cannot give you an exact answer because i don't have windows installed.</p> <p>For debugging this use your first pipeline (in linux works). Use parameter -v with gst-launch and put element identity just before autovideosink. This will print buffer information that passes through element identity, look for anythin...
1
2010-02-26T12:31:13Z
[ "c++", "python", "linux", "audio", "gstreamer" ]
music visualization error with gstreamer
2,339,512
<p>hi I am trying to visualize a music file in gstreamer using the following command:</p> <pre><code>gst-launch filesrc location=file.mp3 ! decodebin ! audioconvert ! tee name=myT myT. ! queue ! autoaudiosink myT. ! queue ! goom ! colorspace ! autovideosink </code></pre> <p>But I get this error : "There may be a ti...
1
2010-02-26T04:29:39Z
6,833,291
<p>For <code>There may be a timestamping problem, or this computer is too slow.</code> <strong>Error</strong> Try <code>sync=false</code> like</p> <pre><code>`gst-launch filesrc location=file.mp3 ! decodebin ! audioconvert ! tee name=myT myT. ! queue ! autoaudiosink myT. ! queue ! goom ! colorspace ! autovideosink syn...
0
2011-07-26T16:22:26Z
[ "c++", "python", "linux", "audio", "gstreamer" ]
RGB to VIBGYOR in python
2,339,554
<p>After downloading an image and getting the rgb color code is there any algorithm to find in which range of VIBGYOR that particular rgb color code match?</p> <p>regards</p> <p>Arun </p>
0
2010-02-26T04:44:26Z
2,339,599
<p>The color range for VIBGYOR (or spectral colors) isn't the same as RGB. </p> <p>Check out wikipedia on color: <a href="http://en.wikipedia.org/wiki/Color" rel="nofollow">http://en.wikipedia.org/wiki/Color</a></p> <p>Pay special attention to "Spectral colors and color reproduction"</p> <p>An example of the issue i...
1
2010-02-26T05:04:24Z
[ "python" ]
RGB to VIBGYOR in python
2,339,554
<p>After downloading an image and getting the rgb color code is there any algorithm to find in which range of VIBGYOR that particular rgb color code match?</p> <p>regards</p> <p>Arun </p>
0
2010-02-26T04:44:26Z
2,339,601
<p>You can use <a href="http://docs.python.org/library/colorsys.html#colorsys.rgb_to_hsv" rel="nofollow"><code>colorsys.rgb_to_hsv()</code></a> to convert it, then take the hue from that.</p>
0
2010-02-26T05:05:01Z
[ "python" ]
Error while transforming .py to .exe
2,339,583
<p>When I try to transform my script in an executable, I get this error after it's done:</p> <pre><code>Traceback (most recent call last): File "shd-WinResize.py", line 4, in &lt;module&gt; File "zipextimporter.pyo", line 98, in load_module ImportError: MemoryLoadLibrary failed loading win32api.pyd </code></pre> ...
1
2010-02-26T04:55:54Z
5,953,572
<p>PY2EXE in Windows Vista and Windows 7 apparantly gets confused by some of the DLLs it needs to import. Here's the solution, which was inspired by <a href="http://stackoverflow.com/questions/1979486/py2exe-win32api-pyc-importerror-dll-load-failed">another post</a>:</p> <pre><code>from distutils.core import setup imp...
0
2011-05-10T16:56:04Z
[ "python", "winapi", "py2exe" ]
Creating a Cron Job - Linux / Python
2,339,725
<p>Hi I have a Django script that I need to run,</p> <p>I think the commands could be called through bash.</p> <p>Thing is the script causes memory leaks after a long a period of time, so I would like to create an external cron job which calls the Python script. So the script would terminate and restart while retakin...
3
2010-02-26T05:46:07Z
2,339,753
<p>If you have an executable, say <code>/home/bin/foobar</code>, that restarts the script, and want to run it (say) every 10 minutes, the crontab entry needs to be:</p> <pre><code>*/10 * * * * /home/bin/foobar </code></pre> <p>which says to run it at every minute divisible by 10, every hour, every day.</p> <p>If yo...
7
2010-02-26T05:55:00Z
[ "python", "linux", "django", "ubuntu" ]
Creating a Cron Job - Linux / Python
2,339,725
<p>Hi I have a Django script that I need to run,</p> <p>I think the commands could be called through bash.</p> <p>Thing is the script causes memory leaks after a long a period of time, so I would like to create an external cron job which calls the Python script. So the script would terminate and restart while retakin...
3
2010-02-26T05:46:07Z
2,339,784
<p>The problem with a cron job is that it will start every so often regardless of whether the previous instance is finished. What I would recommend is to have your script start a new instance of itself after a certain amount of time, then exit.</p>
1
2010-02-26T06:02:17Z
[ "python", "linux", "django", "ubuntu" ]
Creating a Cron Job - Linux / Python
2,339,725
<p>Hi I have a Django script that I need to run,</p> <p>I think the commands could be called through bash.</p> <p>Thing is the script causes memory leaks after a long a period of time, so I would like to create an external cron job which calls the Python script. So the script would terminate and restart while retakin...
3
2010-02-26T05:46:07Z
2,343,349
<p>i think <a href="http://code.google.com/p/django-cron/" rel="nofollow">http://code.google.com/p/django-cron/</a> should be interesting for you</p> <p>its a platform independand cron-lib for django, and works as well on windows servers</p>
1
2010-02-26T17:03:59Z
[ "python", "linux", "django", "ubuntu" ]
Creating a Cron Job - Linux / Python
2,339,725
<p>Hi I have a Django script that I need to run,</p> <p>I think the commands could be called through bash.</p> <p>Thing is the script causes memory leaks after a long a period of time, so I would like to create an external cron job which calls the Python script. So the script would terminate and restart while retakin...
3
2010-02-26T05:46:07Z
2,344,559
<p>Have you taken a look at <a href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/#howto-custom-management-commands" rel="nofollow">custom management commands</a> for your django app? They work like any other command from <code>manage.py</code>, except you can write them.</p> <blockquote> <...
2
2010-02-26T20:20:21Z
[ "python", "linux", "django", "ubuntu" ]
fabric password
2,339,735
<p>Every time fabric runs, it asks for root password, can it be sent along same for automated proposes.</p> <pre><code>fab staging test </code></pre>
28
2010-02-26T05:48:50Z
2,339,767
<p><code>fab -h</code> will show you all the options, you can also read them <a href="http://docs.fabfile.org/en/1.10/usage/fab.html#command-line-options" rel="nofollow">here</a>.</p> <p>In particular, and I quote,</p> <blockquote> <p>-p PASSWORD, --password=PASSWORD</p> <p>Sets env.password to the given strin...
42
2010-02-26T05:58:37Z
[ "python", "fabric" ]
fabric password
2,339,735
<p>Every time fabric runs, it asks for root password, can it be sent along same for automated proposes.</p> <pre><code>fab staging test </code></pre>
28
2010-02-26T05:48:50Z
2,340,889
<p>I know you've asked about password but wouldn't it better to configure the system so that you can doing fabric (i.e. SSH) without password?</p> <p>For this, on local machine do:</p> <ol> <li><code>ssh-keygen</code> and agree with all defaults (if you have no reasons do otherwise)</li> <li><code>cat ~/.ssh/id_rsa.p...
49
2010-02-26T10:29:15Z
[ "python", "fabric" ]
fabric password
2,339,735
<p>Every time fabric runs, it asks for root password, can it be sent along same for automated proposes.</p> <pre><code>fab staging test </code></pre>
28
2010-02-26T05:48:50Z
5,318,248
<p>One way to do this without putting the password in the process list (commands show up in ps aux) is to put it in the fabfile.py like so:</p> <pre><code>from fabric.context_managers import env env.password = 'PASSWORD' </code></pre> <p>Put that before anything that goes to the remote system and it won't ask for a p...
3
2011-03-15T21:23:04Z
[ "python", "fabric" ]
fabric password
2,339,735
<p>Every time fabric runs, it asks for root password, can it be sent along same for automated proposes.</p> <pre><code>fab staging test </code></pre>
28
2010-02-26T05:48:50Z
5,568,219
<p>You can also set passwords on a per host basis. It wasn't obvious to me, so here it goes for anyone looking for this:</p> <pre><code>from fabric import env env.hosts = ['user1@host1:port1', 'user2@host2.port2'] env.passwords = {'user1@host1:port1': 'password1', 'user2@host2.port2': 'password2'} </code></pre> <p>Fa...
36
2011-04-06T14:40:18Z
[ "python", "fabric" ]
fabric password
2,339,735
<p>Every time fabric runs, it asks for root password, can it be sent along same for automated proposes.</p> <pre><code>fab staging test </code></pre>
28
2010-02-26T05:48:50Z
19,408,235
<p>Just to add for anyone who winds up here from a search, you can specify the -I option when running fab for it to prompt you for a default password to use. This way it won't be visible in your command history</p> <p>example:</p> <pre><code>$ fab -I my_task Initial value for env.password: </code></pre>
4
2013-10-16T16:01:40Z
[ "python", "fabric" ]
HTTP POST Requests require multiple transmissions?
2,339,742
<p>I found the quoted text in Programming Python 3rd edition by Mark Lutz from Chapter 16: Server-Side Scripting (page 987):</p> <blockquote> <p>Forms also include a method option to specify the encoding style to be used to send data over a socket to the target server machine. Here, we use the <strong>post style, wh...
2
2010-02-26T05:51:15Z
2,339,754
<p>Simple POST request is in single step. but when you are uploading a file, than the form is posted in multiple parts. In that case, the content type <strong>application/x-www-form-urlencoded</strong> is changed to <strong>multipart/form-data</strong>.</p>
1
2010-02-26T05:56:02Z
[ "python", "http", "post", "cgi", "get" ]
HTTP POST Requests require multiple transmissions?
2,339,742
<p>I found the quoted text in Programming Python 3rd edition by Mark Lutz from Chapter 16: Server-Side Scripting (page 987):</p> <blockquote> <p>Forms also include a method option to specify the encoding style to be used to send data over a socket to the target server machine. Here, we use the <strong>post style, wh...
2
2010-02-26T05:51:15Z
2,790,879
<p>Yes, there is only one transmission of data between server and client.</p> <p>The context of the passage was referring to communication between web server and cgi application. Server communication between the web server and the cgi application using POST happens in two separate transfers. The request for the python...
0
2010-05-07T18:40:41Z
[ "python", "http", "post", "cgi", "get" ]