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 listlengths 1 5 |
|---|---|---|---|---|---|---|---|---|---|
How can I enumerate/list all installed applications in Windows XP? | 802,499 | <p>When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs]. </p>
<p>I would prefer to do it in Python, but C or C++ is also fine.</p>
| 6 | 2009-04-29T14:02:12Z | 802,513 | <p>If you mean the list of installed applications that is shown in Add\Remove Programs in the control panel, you can find it in the registry key:</p>
<pre><code>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
</code></pre>
<p><a href="http://support.microsoft.com/kb/247501">more info about how ... | 10 | 2009-04-29T14:06:25Z | [
"c++",
"python",
"winapi",
"enumeration"
] |
How can I enumerate/list all installed applications in Windows XP? | 802,499 | <p>When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs]. </p>
<p>I would prefer to do it in Python, but C or C++ is also fine.</p>
| 6 | 2009-04-29T14:02:12Z | 803,056 | <p>Control Panel uses Win32 COM api, which is the official method (see Google Groups, Win32)<br />
Never rely on registry.</p>
| 7 | 2009-04-29T15:57:31Z | [
"c++",
"python",
"winapi",
"enumeration"
] |
How can I enumerate/list all installed applications in Windows XP? | 802,499 | <p>When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs]. </p>
<p>I would prefer to do it in Python, but C or C++ is also fine.</p>
| 6 | 2009-04-29T14:02:12Z | 804,547 | <p>The <a href="http://www.microsoft.com/technet/scriptcenter/scripts/python/default.mspx?mfr=true">Microsoft Script Repository</a> has a <a href="http://www.microsoft.com/technet/scriptcenter/scripts/python/apps/user/usappy03.mspx?mfr=true">script for listing all installed software</a>.</p>
<pre><code>import win32com... | 6 | 2009-04-29T22:23:37Z | [
"c++",
"python",
"winapi",
"enumeration"
] |
How can I enumerate/list all installed applications in Windows XP? | 802,499 | <p>When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs]. </p>
<p>I would prefer to do it in Python, but C or C++ is also fine.</p>
| 6 | 2009-04-29T14:02:12Z | 3,511,659 | <p>C#.net code for getting the list of installed software using WMI in xp and win7(wmi is the only way in win7) </p>
<pre><code> WqlObjectQuery wqlQuery =
new WqlObjectQuery("SELECT * FROM Win32_Product");
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(wqlQuery);
... | 3 | 2010-08-18T11:43:00Z | [
"c++",
"python",
"winapi",
"enumeration"
] |
How can I enumerate/list all installed applications in Windows XP? | 802,499 | <p>When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs]. </p>
<p>I would prefer to do it in Python, but C or C++ is also fine.</p>
| 6 | 2009-04-29T14:02:12Z | 9,757,013 | <p>The best registry-based implementation that I have seen is the one written by Chris Wright (chris128) posted at <a href="http://www.vbforums.com/showthread.php?t=598355" rel="nofollow">http://www.vbforums.com/showthread.php?t=598355</a>. It uses multiple registry keys and is a lot more complex than any of the answer... | 3 | 2012-03-18T08:30:37Z | [
"c++",
"python",
"winapi",
"enumeration"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 802,617 | <p>Python has no equivalent of "final". It doesn't have "public" and "protected" either, except by naming convention. It's not that "bondage and discipline".</p>
| 5 | 2009-04-29T14:28:29Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 802,622 | <p>There is no such thing. In general, the Python attitude is "if you don't want this modified, just don't modify it". Clients of an API are unlikely to just poke around your undocumented internals anyway.</p>
<p>You could, I suppose, work around this by using tuples or namedtuples for the relevant bits of your model,... | 7 | 2009-04-29T14:29:04Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 802,623 | <p><a href="http://code.activestate.com/recipes/576527/" rel="nofollow">http://code.activestate.com/recipes/576527/</a> defines a freeze function, although it doesn't work perfectly.</p>
<p>I would consider just leaving it mutable though.</p>
| 3 | 2009-04-29T14:29:05Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 802,631 | <p>There is no ``final'' equivalent in Python.</p>
<p>But, to create read-only fields of class instances, you can use the <a href="http://docs.python.org/3.0/library/functions.html#property">property</a> function.</p>
<p><strong>Edit</strong>: perhaps you want something like this:</p>
<pre><code>class WriteOnceReadW... | 43 | 2009-04-29T14:30:34Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 802,642 | <p>Having a variable in Java be <code>final</code> basically means that once you assign to a variable, you may not reassign that variable to point to another object. It actually doesn't mean that the object can't be modified. For example, the following Java code works perfectly well:</p>
<pre><code>public final List... | 37 | 2009-04-29T14:32:44Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 802,679 | <p>An assign-once variable is a design issue. You design your application in a way that the variable is set once and once only.</p>
<p>However, if you want run-time checking of your design, you can do it with a wrapper around the object.</p>
<pre><code>class OnePingOnlyPleaseVassily( object ):
def __init__( self... | 8 | 2009-04-29T14:41:33Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 1,062,995 | <p>you can simulate something like that through the <a href="http://docs.python.org/reference/datamodel.html#customizing-attribute-access" rel="nofollow">descriptor protocol</a>, since it allows to define reading and setting a variable the way you wish.</p>
<pre><code>class Foo(object):
@property
def myvar(self):... | 5 | 2009-06-30T10:41:27Z | [
"java",
"python",
"keyword",
"final"
] |
`final` keyword equivalent for variables in Python? | 802,578 | <p>I couldn't find documentation on an equivalent of Java's <code>final</code> in Python, is there such a thing?</p>
<p>I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for thi... | 25 | 2009-04-29T14:21:07Z | 18,670,083 | <p>Although this is an old question, I figured I would add yet another potential option: You can also use <code>assert</code> to verify a variable is set to what you originally intended it to be set to â a double checking if you will. Although this is not the same as <code>final</code> in Java, it can be used to crea... | 0 | 2013-09-07T05:29:23Z | [
"java",
"python",
"keyword",
"final"
] |
Python - Possible to force raise exceptions regardless try/except blocks? | 802,804 | <p>In Python is there any language (or interpreter) feature to force the python interpreter to always raise exceptions even if the exception offending code is inside a try/except block ?</p>
<p>I've just inherited a larger and old codebase written in python, whose purpose is to communicate with some custom designed ha... | 5 | 2009-04-29T15:06:40Z | 802,822 | <p>You can use multiple exception handlers to handle multiple exceptions.</p>
<pre><code>try:
serialport.write(MSG)
except Handler1:
some_logging_function_mostly_not_working_that_might_be_here_or_not()
#or just:
#pass
except Handler2:
some_logging_function_mostly_not_working_that_might_be_here_or_n... | -3 | 2009-04-29T15:10:59Z | [
"python",
"exception"
] |
Python - Possible to force raise exceptions regardless try/except blocks? | 802,804 | <p>In Python is there any language (or interpreter) feature to force the python interpreter to always raise exceptions even if the exception offending code is inside a try/except block ?</p>
<p>I've just inherited a larger and old codebase written in python, whose purpose is to communicate with some custom designed ha... | 5 | 2009-04-29T15:06:40Z | 802,826 | <p>The "all-exceptions" <code>except:</code> block is a remarkably bad thing and must simply be found and replaced with sensible except handling.</p>
<p>In this case <code>grep</code> is your friend. A good IDE can help make these unpleasant chores manageable. </p>
<p>But there's no "ignore the code as written" opt... | 12 | 2009-04-29T15:12:16Z | [
"python",
"exception"
] |
Python - Possible to force raise exceptions regardless try/except blocks? | 802,804 | <p>In Python is there any language (or interpreter) feature to force the python interpreter to always raise exceptions even if the exception offending code is inside a try/except block ?</p>
<p>I've just inherited a larger and old codebase written in python, whose purpose is to communicate with some custom designed ha... | 5 | 2009-04-29T15:06:40Z | 802,837 | <p>No, not really. Your best bet is to change the code to something more like this:</p>
<pre><code>try:
serialport.write(MSG)
except:
some_logging_function_mostly_not_working_that_might_be_here_or_not()
raise
</code></pre>
<p>This will make it re-raise the exact exception. The main thing that you need t... | 3 | 2009-04-29T15:15:44Z | [
"python",
"exception"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 803,396 | <p>You can try this:</p>
<pre><code>import subprocess
import sys
process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
while True:
out = process.stdout.read(1)
if out == '' and process.poll() != None:
break
if out != '':
sys.stdout.write(out)
sys.stdout.flus... | 11 | 2009-04-29T17:21:10Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 803,408 | <p>I ran into the same problem awhile back. My solution was to ditch iterating for the <code>read</code> method, which will return immediately even if your subprocess isn't finished executing, etc.</p>
| 2 | 2009-04-29T17:24:09Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 803,421 | <p>I tried this, and for some reason while the code</p>
<pre><code>for line in p.stdout:
...
</code></pre>
<p>buffers aggressively, the variant</p>
<pre><code>while True:
line = p.stdout.readline()
if not line: break
...
</code></pre>
<p>does not. Apparently this is a known bug: <a href="http://bugs.python.... | 43 | 2009-04-29T17:26:53Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 3,186,931 | <p>Using pexpect [ <a href="http://www.noah.org/wiki/Pexpect" rel="nofollow">http://www.noah.org/wiki/Pexpect</a> ] with non-blocking readlines will resolve this problem. It stems from the fact that pipes are buffered, and so your app's output is getting buffered by the pipe, therefore you can't get to that output unti... | 0 | 2010-07-06T14:09:22Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 6,414,278 | <pre><code>p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1)
for line in iter(p.stdout.readline, b''):
print line,
p.stdout.close()
p.wait()
</code></pre>
| 21 | 2011-06-20T16:13:51Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 15,288,921 | <p>Complete solution:</p>
<pre><code>import contextlib
import subprocess
# Unix, Windows and old Macintosh end-of-line
newlines = ['\n', '\r\n', '\r']
def unbuffered(proc, stream='stdout'):
stream = getattr(proc, stream)
with contextlib.closing(stream):
while True:
out = []
las... | 0 | 2013-03-08T07:33:30Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 21,317,334 | <p>I used this solution to get realtime output on a subprocess. This loop will stop as soon as the process completes leaving out a need for a break statement or possible infinite loop. </p>
<pre><code>sub_process = subprocess.Popen(my_command, close_fds=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)... | 1 | 2014-01-23T19:14:21Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 30,214,720 | <p>Real Time Output Issue resolved:
I did encountered similar issue in Python, while capturing the real time output from c program. I added "<strong>fflush(stdout)</strong>;" in my C code. It worked for me. Here is the snip the code </p>
<p><< C Program >></p>
<pre><code>#include <stdio.h>
void main()
{
... | 0 | 2015-05-13T12:26:10Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 36,660,310 | <p>This is what I did:</p>
<pre><code>def read_command_output(command):
process = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return iter(process.stdout.readline, b"")
for output_line in read_command_output(cmd):
print(line)
</code></pre>
<p>It continuous... | -1 | 2016-04-16T05:01:55Z | [
"python",
"subprocess"
] |
Getting realtime output using subprocess | 803,265 | <p>I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.</p>
<p>I figured that I'd just execute the program using subproc... | 64 | 2009-04-29T16:45:48Z | 38,745,040 | <p>Found this "plug-and-play" function <a href="http://www.saltycrane.com/blog/2009/10/how-capture-stdout-in-real-time-python/" rel="nofollow">here</a>. Worked like a charm!</p>
<pre><code>import subprocess
def myrun(cmd):
"""from http://blog.kagesenshi.org/2008/02/teeing-python-subprocesspopen-output.html
""... | -1 | 2016-08-03T13:28:47Z | [
"python",
"subprocess"
] |
Inserting multiple model instances using a single db.put() on Google App Engine | 803,517 | <p><strong>Edit:</strong> Sorry I didn't clarify this, it's a Google App Engine related question.</p>
<p>According to <a href="http://code.google.com/appengine/docs/python/datastore/functions.html" rel="nofollow">this</a>, I can give db.put() a list of model instances and ask it to input them all into the datastore. H... | 3 | 2009-04-29T17:53:25Z | 804,295 | <p>Please define what you mean by "going wrong" -- the tiny pieces of code you're showing could perfectly well be part of an app that's quite "right". Consider e.g.:</p>
<pre><code>class Hello(db.Model):
name = db.StringProperty()
when = db.DateTimeProperty()
class MainHandler(webapp.RequestHandler):
def get(... | 4 | 2009-04-29T21:12:22Z | [
"python",
"google-app-engine"
] |
Merge two lists of lists - Python | 803,526 | <p>This is a great primer but doesn't answer what I need:
<a href="http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python">http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python</a></p>
<p>I have two Python lists, each is a list of datetime,value pairs:</p>
<pre><code>l... | 1 | 2009-04-29T17:57:29Z | 803,561 | <p>Here's some code that does what you asked for. You can turn your list of pairs into a dictionary straightforwardly. Then keys that are shared can be found by intersecting the sets of keys. Finally, constructing the result dictionary is easy given the set of shared keys.</p>
<pre><code>dict_a = dict(list_a)
dict_x =... | 3 | 2009-04-29T18:08:34Z | [
"python",
"django",
"list"
] |
Merge two lists of lists - Python | 803,526 | <p>This is a great primer but doesn't answer what I need:
<a href="http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python">http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python</a></p>
<p>I have two Python lists, each is a list of datetime,value pairs:</p>
<pre><code>l... | 1 | 2009-04-29T17:57:29Z | 803,667 | <p>"I want to make a list, list_c, corresponding to each list_a which has each datetime from list_x and value_a/value_x."</p>
<pre><code>def merge_lists( list_a, list_x ):
dict_x= dict(list_x)
for k,v in list_a:
if k in dict_x:
yield k, (v, dict_x[k])
</code></pre>
<p>Something like that m... | 3 | 2009-04-29T18:35:51Z | [
"python",
"django",
"list"
] |
Merge two lists of lists - Python | 803,526 | <p>This is a great primer but doesn't answer what I need:
<a href="http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python">http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python</a></p>
<p>I have two Python lists, each is a list of datetime,value pairs:</p>
<pre><code>l... | 1 | 2009-04-29T17:57:29Z | 1,624,575 | <p>Could try extend:</p>
<pre><code>list_a.extend(list_b)
</code></pre>
| 0 | 2009-10-26T12:40:41Z | [
"python",
"django",
"list"
] |
Merge two lists of lists - Python | 803,526 | <p>This is a great primer but doesn't answer what I need:
<a href="http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python">http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python</a></p>
<p>I have two Python lists, each is a list of datetime,value pairs:</p>
<pre><code>l... | 1 | 2009-04-29T17:57:29Z | 1,794,230 | <p>Nothing beats a nice functional one-liner:</p>
<pre><code>reduce(lambda l1,l2: l1 + l2, list)
</code></pre>
| 2 | 2009-11-25T02:08:39Z | [
"python",
"django",
"list"
] |
Merge two lists of lists - Python | 803,526 | <p>This is a great primer but doesn't answer what I need:
<a href="http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python">http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python</a></p>
<p>I have two Python lists, each is a list of datetime,value pairs:</p>
<pre><code>l... | 1 | 2009-04-29T17:57:29Z | 3,417,675 | <p>List concatenation and list extension are available options:</p>
<pre>
>>> mylist = [1, 2]
>>> mylist + [5, 6] # concatenation
[1,2,5,6]
>>> mylist.extend([7, 8]) # extension
>>> print mylist
[1,2,7,8]
>>> mylist += [9, 10] # extension
>>> prin... | 2 | 2010-08-05T18:00:15Z | [
"python",
"django",
"list"
] |
Python embedding with threads -- avoiding deadlocks? | 803,566 | <p>Is there any way to embed python, allow callbacks from python to C++, allowing the Pythhon code to spawn threads, and avoiding deadlocks?</p>
<p>The problem is this:</p>
<ul>
<li><p>To call into Python, I need to hold the GIL. Typically, I do this by getting the main thread state when I first create the interprete... | 7 | 2009-04-29T18:09:33Z | 803,703 | <p>"When calling into Python, I may need to hold the same locks, because I may be iterating over some collection of objects, for example."</p>
<p>This often indicates that a single process with multiple threads isn't appropriate. Perhaps this is a situation where multiple processes -- each with a specific object from... | 2 | 2009-04-29T18:44:19Z | [
"python",
"multithreading",
"deadlock",
"embedding"
] |
Python embedding with threads -- avoiding deadlocks? | 803,566 | <p>Is there any way to embed python, allow callbacks from python to C++, allowing the Pythhon code to spawn threads, and avoiding deadlocks?</p>
<p>The problem is this:</p>
<ul>
<li><p>To call into Python, I need to hold the GIL. Typically, I do this by getting the main thread state when I first create the interprete... | 7 | 2009-04-29T18:09:33Z | 804,431 | <p>The code that is called by python should release the GIL before taking any of your locks.
That way I believe it can't get into the dead-lock.</p>
| 1 | 2009-04-29T21:49:50Z | [
"python",
"multithreading",
"deadlock",
"embedding"
] |
Python embedding with threads -- avoiding deadlocks? | 803,566 | <p>Is there any way to embed python, allow callbacks from python to C++, allowing the Pythhon code to spawn threads, and avoiding deadlocks?</p>
<p>The problem is this:</p>
<ul>
<li><p>To call into Python, I need to hold the GIL. Typically, I do this by getting the main thread state when I first create the interprete... | 7 | 2009-04-29T18:09:33Z | 808,498 | <p>There was recently some discussion of a similar issue on the pyopenssl list. I'm afraid if I try to explain this I'm going to get it wrong, so instead I'll refer you to <a href="https://bugs.launchpad.net/pyopenssl/%2Bbug/344815" rel="nofollow">the problem in question</a>.</p>
| 0 | 2009-04-30T18:53:15Z | [
"python",
"multithreading",
"deadlock",
"embedding"
] |
How do you use FCKEditor's image upload and browser with mod-wsgi? | 803,613 | <p>I am using FCKEditor within a Django app served by Apache/mod-wsgi. I don't want to install php just for FCKEditor andI see FCKEditor offers image uploading and image browsing through Python. I just haven't found good instructions on how to set this all up.</p>
<p>So currently Django is running through a wsgi inter... | 1 | 2009-04-29T18:23:30Z | 820,889 | <p>This describes how to embed the FCK editor and enable image uploading.</p>
<p>First you need to edit fckconfig.js to change the image upload
URL to point to some URL inside your server.</p>
<pre><code>FCKConfig.ImageUploadURL = "/myapp/root/imageUploader";
</code></pre>
<p>This will point to the server relative U... | 1 | 2009-05-04T16:48:09Z | [
"python",
"django",
"fckeditor",
"mod-wsgi"
] |
How do you use FCKEditor's image upload and browser with mod-wsgi? | 803,613 | <p>I am using FCKEditor within a Django app served by Apache/mod-wsgi. I don't want to install php just for FCKEditor andI see FCKEditor offers image uploading and image browsing through Python. I just haven't found good instructions on how to set this all up.</p>
<p>So currently Django is running through a wsgi inter... | 1 | 2009-04-29T18:23:30Z | 951,920 | <p>Edit: Ultimately I was unhappy with this solution also so I made a <a href="http://bitbucket.org/megaman821/django-fckconnector/" rel="nofollow">Django app</a> that takes care of the file uploads and browsing.</p>
<p>This is the solution I finally hacked together after reading the fckeditor code:</p>
<pre><code>im... | 0 | 2009-06-04T17:18:57Z | [
"python",
"django",
"fckeditor",
"mod-wsgi"
] |
Passing functions with arguments to another function in Python? | 803,616 | <p>Is it possible to pass functions with arguments to another function in Python?</p>
<p>Say for something like:</p>
<pre><code>def Perform ( function ) :
function
</code></pre>
<p>but the functions to be passed will be like:</p>
<pre><code>Action1()
Action2(p)
Action3(p,r)
</code></pre>
| 98 | 2009-04-29T18:24:26Z | 803,626 | <p>This is what lambda is for:</p>
<pre><code>def Perform(f):
f()
Perform(lambda: Action1())
Perform(lambda: Action2(p))
Perform(lambda: Action3(p, r))
</code></pre>
| 56 | 2009-04-29T18:27:44Z | [
"python",
"function"
] |
Passing functions with arguments to another function in Python? | 803,616 | <p>Is it possible to pass functions with arguments to another function in Python?</p>
<p>Say for something like:</p>
<pre><code>def Perform ( function ) :
function
</code></pre>
<p>but the functions to be passed will be like:</p>
<pre><code>Action1()
Action2(p)
Action3(p,r)
</code></pre>
| 98 | 2009-04-29T18:24:26Z | 803,632 | <p>Do you mean this?</p>
<pre><code>def perform( fun, *args ):
fun( *args )
def action1( args ):
something
def action2( args ):
something
perform( action1 )
perform( action2, p )
perform( action3, p, r )
</code></pre>
| 155 | 2009-04-29T18:28:24Z | [
"python",
"function"
] |
Passing functions with arguments to another function in Python? | 803,616 | <p>Is it possible to pass functions with arguments to another function in Python?</p>
<p>Say for something like:</p>
<pre><code>def Perform ( function ) :
function
</code></pre>
<p>but the functions to be passed will be like:</p>
<pre><code>Action1()
Action2(p)
Action3(p,r)
</code></pre>
| 98 | 2009-04-29T18:24:26Z | 803,668 | <p>Use functools.partial, not lambdas! And ofc Perform is a useless function, you can pass around functions directly.</p>
<p><pre><code>for func in [Action1, partial(Action2, p), partial(Action3, p, r)]:
func()
</pre></code></p>
| 13 | 2009-04-29T18:36:14Z | [
"python",
"function"
] |
Passing functions with arguments to another function in Python? | 803,616 | <p>Is it possible to pass functions with arguments to another function in Python?</p>
<p>Say for something like:</p>
<pre><code>def Perform ( function ) :
function
</code></pre>
<p>but the functions to be passed will be like:</p>
<pre><code>Action1()
Action2(p)
Action3(p,r)
</code></pre>
| 98 | 2009-04-29T18:24:26Z | 804,346 | <p>You can use the partial function from functools like so.</p>
<pre><code>from functools import partial
def perform(f):
f()
perform(Action1)
perform(partial(Action2, p))
perform(partial(Action3, p, r))
</code></pre>
<p>Also works with keywords</p>
<pre><code>perform(partial(Action4, param1=p))
</code></pre>
| 17 | 2009-04-29T21:23:23Z | [
"python",
"function"
] |
Passing functions with arguments to another function in Python? | 803,616 | <p>Is it possible to pass functions with arguments to another function in Python?</p>
<p>Say for something like:</p>
<pre><code>def Perform ( function ) :
function
</code></pre>
<p>but the functions to be passed will be like:</p>
<pre><code>Action1()
Action2(p)
Action3(p,r)
</code></pre>
| 98 | 2009-04-29T18:24:26Z | 1,053,007 | <p>(months later) a tiny real example where lambda is useful, partial not:<br />
say you want various 1-dimensional cross-sections through a 2-dimensional function,
like slices through a row of hills.<br />
<code>quadf( x, f )</code> takes a 1-d <code>f</code> and calls it for various <code>x</code>.<br />
To call it f... | 5 | 2009-06-27T15:12:20Z | [
"python",
"function"
] |
Passing functions with arguments to another function in Python? | 803,616 | <p>Is it possible to pass functions with arguments to another function in Python?</p>
<p>Say for something like:</p>
<pre><code>def Perform ( function ) :
function
</code></pre>
<p>but the functions to be passed will be like:</p>
<pre><code>Action1()
Action2(p)
Action3(p,r)
</code></pre>
| 98 | 2009-04-29T18:24:26Z | 24,169,584 | <p>Here is a way to do it with a closure:</p>
<pre><code> def generate_add_mult_func(func):
def function_generator(x):
return reduce(func,range(1,x))
return function_generator
def add(x,y):
return x+y
def mult(x,y):
return x*y
adding=generate_add_mult_func(... | 0 | 2014-06-11T18:02:35Z | [
"python",
"function"
] |
Best way to convert a Unicode URL to ASCII (UTF-8 percent-escaped) in Python? | 804,336 | <p>I'm wondering what's the best way -- or if there's a simple way with the standard library -- to convert a URL with Unicode chars in the domain name and path to the equivalent ASCII URL, encoded with domain as IDNA and the path %-encoded, as per RFC 3986.</p>
<p>I get from the user a URL in UTF-8. So if they've type... | 26 | 2009-04-29T21:21:25Z | 804,380 | <h2>Code:</h2>
<pre><code>import urlparse, urllib
def fixurl(url):
# turn string into unicode
if not isinstance(url,unicode):
url = url.decode('utf8')
# parse it
parsed = urlparse.urlsplit(url)
# divide the netloc further
userpass,at,hostport = parsed.netloc.rpartition('@')
user,... | 43 | 2009-04-29T21:36:32Z | [
"python",
"url",
"unicode",
"utf-8"
] |
Best way to convert a Unicode URL to ASCII (UTF-8 percent-escaped) in Python? | 804,336 | <p>I'm wondering what's the best way -- or if there's a simple way with the standard library -- to convert a URL with Unicode chars in the domain name and path to the equivalent ASCII URL, encoded with domain as IDNA and the path %-encoded, as per RFC 3986.</p>
<p>I get from the user a URL in UTF-8. So if they've type... | 26 | 2009-04-29T21:21:25Z | 804,382 | <p>You might use <a href="http://docs.python.org/library/urlparse.html#urlparse.urlsplit" rel="nofollow"><code>urlparse.urlsplit</code></a> instead, but otherwise you seem to have a very straightforward solution, there.</p>
<pre><code>protocol, domain, path, query, fragment = urlparse.urlsplit(url)
</code></pre>
<p>(... | 1 | 2009-04-29T21:36:42Z | [
"python",
"url",
"unicode",
"utf-8"
] |
Best way to convert a Unicode URL to ASCII (UTF-8 percent-escaped) in Python? | 804,336 | <p>I'm wondering what's the best way -- or if there's a simple way with the standard library -- to convert a URL with Unicode chars in the domain name and path to the equivalent ASCII URL, encoded with domain as IDNA and the path %-encoded, as per RFC 3986.</p>
<p>I get from the user a URL in UTF-8. So if they've type... | 26 | 2009-04-29T21:21:25Z | 804,408 | <p>there's some RFC-3896 <em>url parsing</em> work underway (e.g. as part of the Summer Of Code) but nothing in the standard library yet AFAIK -- and nothing much on the <em>uri encoding</em> side of things either, again AFAIK. So you might as well go with MizardX's elegant approach.</p>
| 2 | 2009-04-29T21:44:08Z | [
"python",
"url",
"unicode",
"utf-8"
] |
Best way to convert a Unicode URL to ASCII (UTF-8 percent-escaped) in Python? | 804,336 | <p>I'm wondering what's the best way -- or if there's a simple way with the standard library -- to convert a URL with Unicode chars in the domain name and path to the equivalent ASCII URL, encoded with domain as IDNA and the path %-encoded, as per RFC 3986.</p>
<p>I get from the user a URL in UTF-8. So if they've type... | 26 | 2009-04-29T21:21:25Z | 805,166 | <p>Okay, with these comments and some bug-fixing in my own code (it didn't handle fragments at all), I've come up with the following <code>canonurl()</code> function -- returns a canonical, ASCII form of the URL:</p>
<pre><code>import re
import urllib
import urlparse
def canonurl(url):
r"""Return the canonical, A... | 1 | 2009-04-30T02:43:17Z | [
"python",
"url",
"unicode",
"utf-8"
] |
Best way to convert a Unicode URL to ASCII (UTF-8 percent-escaped) in Python? | 804,336 | <p>I'm wondering what's the best way -- or if there's a simple way with the standard library -- to convert a URL with Unicode chars in the domain name and path to the equivalent ASCII URL, encoded with domain as IDNA and the path %-encoded, as per RFC 3986.</p>
<p>I get from the user a URL in UTF-8. So if they've type... | 26 | 2009-04-29T21:21:25Z | 4,494,314 | <p>the code given by MizardX isnt 100% correct. This example wont work:</p>
<p>example.com/folder/?page=2</p>
<p>check out django.utils.encoding.iri_to_uri() to convert unicode URL to ASCII urls.</p>
<p><a href="http://docs.djangoproject.com/en/dev/ref/unicode/">http://docs.djangoproject.com/en/dev/ref/unicode/</a><... | 5 | 2010-12-20T21:52:29Z | [
"python",
"url",
"unicode",
"utf-8"
] |
Tool to determine what lowest version of Python required? | 804,538 | <p>Is there something similar to Pylint, that will look at a Python script (or run it), and determine which version of Python each line (or function) requires?</p>
<p>For example, theoretical usage:</p>
<pre><code>$ magic_tool <EOF
with something:
pass
EOF
1: 'with' statement requires Python 2.6 or greater
$ ... | 46 | 2009-04-29T22:21:12Z | 804,917 | <p>Not an actual useful answer but here it goes anyway.
I think this should be doable to make (though probably quite an exercise), for example you could make sure you have all the official grammars for the versions you want to check, like <a href="http://docs.python.org/reference/grammar.html">this one</a> .</p>
<p>Th... | 8 | 2009-04-30T00:35:46Z | [
"python",
"code-analysis"
] |
Tool to determine what lowest version of Python required? | 804,538 | <p>Is there something similar to Pylint, that will look at a Python script (or run it), and determine which version of Python each line (or function) requires?</p>
<p>For example, theoretical usage:</p>
<pre><code>$ magic_tool <EOF
with something:
pass
EOF
1: 'with' statement requires Python 2.6 or greater
$ ... | 46 | 2009-04-29T22:21:12Z | 819,645 | <p>Inspired by this excellent question, I recently put together a script that tries to do this. You can find it on github at <a href="http://github.com/ghewgill/pyqver/tree/master">pyqver</a>.</p>
<p>It's reasonably complete but there are some aspects that are not yet handled (as mentioned in the README file). Feel fr... | 41 | 2009-05-04T10:55:39Z | [
"python",
"code-analysis"
] |
mod_wsgi yield output buffer instead of return | 804,898 | <p>Right now I've got a mod_wsgi script that's structured like this..</p>
<pre><code>def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, ... | 1 | 2009-04-30T00:22:32Z | 804,901 | <pre><code>def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
yield output
</code></pre>
<blockquote>
<p><em>"H... | 7 | 2009-04-30T00:24:28Z | [
"python",
"mod-wsgi",
"yield"
] |
mod_wsgi yield output buffer instead of return | 804,898 | <p>Right now I've got a mod_wsgi script that's structured like this..</p>
<pre><code>def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, ... | 1 | 2009-04-30T00:22:32Z | 821,278 | <p>Don't send the content length and send the output as you derive it.
You don't need to know the size of the output if you simply don't
send the Content-Length header. That way can send part of the response
before you have computed the rest of it.</p>
<pre><code>def application(environ, start_response):
status =... | 0 | 2009-05-04T18:20:40Z | [
"python",
"mod-wsgi",
"yield"
] |
mod_wsgi yield output buffer instead of return | 804,898 | <p>Right now I've got a mod_wsgi script that's structured like this..</p>
<pre><code>def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, ... | 1 | 2009-04-30T00:22:32Z | 1,037,785 | <p>Note that 'yield' should be avoided unless absolutely necessary. In particular 'yield' will be inefficient if yielding lots of small strings. This is because the WSGI specification requires that after each string yielded that the response must be flushed. For Apache/mod_wsgi, flushing means each string being forced ... | 6 | 2009-06-24T11:31:38Z | [
"python",
"mod-wsgi",
"yield"
] |
How to consume XML from RESTful web services using Django / Python? | 804,992 | <p>Should I use PyXML or what's in the standard library? </p>
| 3 | 2009-04-30T01:13:48Z | 804,997 | <p>I always prefer to use the standard library when possible. ElementTree is well known amongst pythonistas, so you should be able to find plenty of examples. Parts of it have also been optimized in C, so it's quite fast.</p>
<p><a href="http://docs.python.org/library/xml.etree.elementtree.html" rel="nofollow">http://... | 3 | 2009-04-30T01:17:45Z | [
"python",
"xml",
"django",
"rest"
] |
How to consume XML from RESTful web services using Django / Python? | 804,992 | <p>Should I use PyXML or what's in the standard library? </p>
| 3 | 2009-04-30T01:13:48Z | 804,998 | <p>ElementTree is provided as part of the standard Python libs. ElementTree is pure python, and cElementTree is the faster C implementation:</p>
<pre><code># Try to use the C implementation first, falling back to python
try:
from xml.etree import cElementTree as ElementTree
except ImportError, e:
from xml.etre... | 9 | 2009-04-30T01:19:00Z | [
"python",
"xml",
"django",
"rest"
] |
How to consume XML from RESTful web services using Django / Python? | 804,992 | <p>Should I use PyXML or what's in the standard library? </p>
| 3 | 2009-04-30T01:13:48Z | 2,347,520 | <p>There's also <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">BeautifulSoup</a>, which has an API some might prefer. Here's an example on how you can extract all tweets that have been favorited from Twitter's Public Timeline:</p>
<pre><code>from BeautifulSoup import BeautifulStoneSoup
import u... | 0 | 2010-02-27T13:43:16Z | [
"python",
"xml",
"django",
"rest"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 805,008 | <p>Why are you using r""? I believe that if you remove the "r" from the beginning, it will be treated as a standard string which may contain spaces. Python should then properly quote the string when sending it to the shell.</p>
| -2 | 2009-04-30T01:22:40Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 805,052 | <pre><code>'c:\Program' is not recognized as an internal or external command,
operable program or batch file.
</code></pre>
<p>To get this message, you are either:</p>
<ol>
<li><p>Using <code>shell=True</code>:</p>
<pre><code>vmrun_cmd = r"c:\Program Files\VMware\VMware Server\vmware-cmd.bat"
subprocess.Popen(vmrun_... | 3 | 2009-04-30T01:46:59Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 805,061 | <p>2 things</p>
<p>1) </p>
<p>You probably don't want to use Pipe
If the output of the subprogram is greater than 64KB it is likely your process will crash.
<a href="http://thraxil.org/users/anders/posts/2008/03/13/Subprocess-Hanging-PIPE-is-your-enemy/" rel="nofollow">http://thraxil.org/users/anders/posts/2008/03/1... | -1 | 2009-04-30T01:49:23Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 805,088 | <p>I believe that list2cmdline(), which is doing the processing of your list args, splits any string arg on whitespace unless the <em>string</em> contains double quotes. So I would expect</p>
<pre><code>vmrun_cmd = r'"c:/Program Files/VMware/VMware Server/vmware-cmd.bat"'
</code></pre>
<p>to be what you want.</p>
<... | 0 | 2009-04-30T02:00:13Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 805,228 | <p>Possibly stupid suggestion, but perhaps try the following, to remove subprocess + spaces from the equation:</p>
<pre><code>import os
from subprocess Popen, PIPE
os.chdir(
os.path.join("C:", "Program Files", "VMware", "VMware Server")
)
p = Popen(
["vmware-cmd.bat", target_vm, list_arg, list_arg2],
std... | -2 | 2009-04-30T03:17:30Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 805,309 | <p>In Python on MS Windows, the subprocess.Popen class uses the CreateProcess API to started the process. CreateProcess takes a string rather than something like an array of arguments. Python uses subprocess.list2cmdline to convert the list of args to a string for CreateProcess.</p>
<p>If I were you, I'd see what subp... | 2 | 2009-04-30T04:11:00Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 806,857 | <p>Here's what I don't like</p>
<pre><code>vmrun_cmd = r"c:/Program Files/VMware/VMware Server/vmware-cmd.bat"
</code></pre>
<p>You've got spaces in the name of the command itself -- which is baffling your shell. Hence the "'c:\Program' is not recognized as an internal or external command,
operable program or batch ... | -2 | 2009-04-30T13:19:59Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 806,971 | <p>If you have spaces in the path, the easiest way I've found to get them interpreted properly is this.</p>
<pre><code>subprocess.call('""' + path + '""')
</code></pre>
<p>I don't know why exactly it needs double double quotes, but that is what works.</p>
| 4 | 2009-04-30T13:41:10Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 992,989 | <p>One problem is that if the command is surrounded with quotes and doesn't have spaces, that could also confuse the shell.</p>
<p>So I do this:</p>
<pre><code>if ' ' in raw_cmd:
fmt = '"%s"'
else:
fmt = '%s'
cmd = fmt % raw_cmd
</code></pre>
| 0 | 2009-06-14T15:09:33Z | [
"python",
"subprocess"
] |
How to use subprocess when multiple arguments contain spaces? | 804,995 | <p>I'm working on a wrapper script that will exercise a vmware executable, allowing for the automation of virtual machine startup/shutdown/register/deregister actions. I'm trying to use subprocess to handle invoking the executable, but the spaces in the executables path and in parameters of the executable are not bein... | 13 | 2009-04-30T01:17:04Z | 36,502,646 | <p>That was quite a hard problem for the last three ours....nothing stated so far did work, neither using r"" or Popen with a list and so on. What did work in the end was a combination of format string and r"". So my solution is this:</p>
<pre><code>subprocess.Popen("{0} -f {1}".format(pathToExe, r'"%s"' % pathToVideo... | 0 | 2016-04-08T14:48:01Z | [
"python",
"subprocess"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 805,081 | <p>Yes, but only with <a href="http://docs.python.org/glossary.html#term-new-style-class">new-style classes</a>. Use the <a href="http://docs.python.org/library/functions.html#super"><code>super()</code></a> function:</p>
<pre><code>class Foo(Bar):
def baz(self, arg):
return super(Foo, self).baz(arg)
</co... | 328 | 2009-04-30T01:58:28Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 805,082 | <p>Python also has <a href="http://docs.python.org/library/functions.html" rel="nofollow">super</a> as well: </p>
<p><code><strong>super</strong>(type[, object-or-type])</code></p>
<blockquote>
<p>Return a proxy object that delegates method calls to a parent or sibling class of type.
This is useful for accessing ... | 46 | 2009-04-30T01:58:31Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 805,085 | <p>There's a super() in Python too. It's a bit wonky, because of Python's old- and new-style classes, but is quite commonly used e.g. in constructors:</p>
<pre><code>class Foo(Bar):
def __init__(self):
super(Foo, self).__init__()
self.baz = 5
</code></pre>
| 9 | 2009-04-30T01:58:46Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 805,091 | <pre><code>ImmediateParentClass.frotz(self)
</code></pre>
<p>will be just fine, whether the immediate parent class defined <code>frotz</code> itself or inherited it. <code>super</code> is only needed for proper support of <em>multiple</em> inheritance (and then it only works if every class uses it properly). In gene... | 50 | 2009-04-30T02:02:38Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 6,407,157 | <p>This is a more abstract method:</p>
<pre class="lang-py prettyprint-override"><code>super(self.__class__,self).baz(arg)
</code></pre>
| -19 | 2011-06-20T05:32:22Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 8,689,564 | <p>I would recommend using <code>CLASS.__bases__</code>
something like this</p>
<pre><code>class A:
def __init__(self):
print "I am Class %s"%self.__class__.__name__
for parentClass in self.__class__.__bases__:
print " I am inherited from:",parentClass.__name__
#parentC... | 5 | 2011-12-31T17:39:11Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 16,057,968 | <p>Here is an example of using <strong>super()</strong>:</p>
<pre><code>#New-style classes inherit from object, or from another new-style class
class Dog(object):
name = ''
moves = []
def __init__(self, name):
self.name = name
def moves_setup(self):
self.moves.append('walk')
... | 17 | 2013-04-17T10:44:59Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 27,402,103 | <p>There is a super() in python also.</p>
<p>Example for how a super class method is called from a sub class method</p>
<pre><code>class Dog(object):
name = ''
moves = []
def __init__(self, name):
self.name = name
def moves_setup(self,x):
self.moves.append('walk')
self.moves.... | 4 | 2014-12-10T13:21:18Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 34,183,634 | <p>If you don't know how many arguments you might get, and want to pass them all through to the child as well:</p>
<pre><code>class Foo(bar)
def baz(self, arg, *args, **kwargs):
# ... Do your thing
return super(Foo, self).baz(arg, *args, **kwargs)
</code></pre>
<p>(From: <a href="http://stackoverf... | 2 | 2015-12-09T16:13:51Z | [
"python",
"inheritance",
"class",
"object"
] |
Call a parent class's method from child class in Python? | 805,066 | <p>When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:</p>
<pre><code>package Foo;
sub frotz {
return "Bamf";
}
package Bar;
@ISA = qw(Foo);
sub frotz... | 271 | 2009-04-30T01:52:31Z | 38,587,017 | <p>Python 3 has a different and simpler syntax for calling parent method.
If <code>Foo</code> class inherits from <code>Bar</code>, then from <code>Bar.__init__</code> can be invoked from <code>Foo</code> using <code>super().__init__()</code>:</p>
<pre><code>class Foo(Bar):
def __init__(self):
super().__in... | 3 | 2016-07-26T10:12:08Z | [
"python",
"inheritance",
"class",
"object"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 806,705 | <p>One way to do it would be to define a grid with a unit size based on the zoom level. So you collect up all the items within a grid by lat,lon to one decimal place. An example is 42.2x73.4. So a point at 42.2003x73.4021 falls in that grid cell. That cell is bounded by 42.2x73.3 and 42.2x73.5.</p>
<p>If there are... | 0 | 2009-04-30T12:40:04Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 807,349 | <p><a href="http://www.maptimize.com/" rel="nofollow">This</a> is a paid service that uses server-side clustering, but I'm not sure how it works. I'm guessing that they just use your data to generate the markers to be shown at each zoom level.</p>
<p><strong>Update:</strong> <a href="http://www.appelsiini.net/2008/11... | 2 | 2009-04-30T14:57:03Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 840,756 | <p>You could simply drop decimals based on the zoom level. Would that work for you?</p>
<p>Our geo indexes are based on morton numbers:
<a href="http://www.rooftopsolutions.nl/article/231" rel="nofollow">http://www.rooftopsolutions.nl/article/231</a> (shameless self promotion).</p>
<p>If you want more precision than ... | 0 | 2009-05-08T16:43:30Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 1,626,690 | <p>I am using Django and Python to cluster real estate and rental listings, and the source can be found <a href="http://forum.mapaplace.com/discussion/3/server-side-marker-clustering-python-source-code/" rel="nofollow">here</a>.</p>
<p>Hope it helps!</p>
| 0 | 2009-10-26T18:58:57Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 1,989,520 | <p>I wrote a blog post about my approach using Python and Django here:</p>
<p><a href="http://www.quanative.com/2010/01/01/server-side-marker-clustering-for-google-maps-with-python/" rel="nofollow">http://www.quanative.com/2010/01/01/server-side-marker-clustering-for-google-maps-with-python/</a></p>
| -4 | 2010-01-01T20:22:54Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 3,486,779 | <p>You might want to take a look at the <a href="http://en.wikipedia.org/wiki/DBSCAN" rel="nofollow">DBSCAN</a> and <a href="http://en.wikipedia.org/wiki/OPTICS_algorithm" rel="nofollow">OPTICS</a> pages on wikipedia, these looks very suitable for clustering places on a map. There is also a page about <a href="http://e... | 1 | 2010-08-15T09:02:07Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Server Side Google Markers Clustering - Python/Django | 805,072 | <p>After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).</p>
<p>Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?</p>
<p>The way I would li... | 7 | 2009-04-30T01:55:16Z | 15,533,333 | <p>You can try my server-side clustering django app:</p>
<p><a href="https://github.com/biodiv/anycluster" rel="nofollow">https://github.com/biodiv/anycluster</a></p>
<p>It prvides a kmeans and a grid cluster.</p>
| 0 | 2013-03-20T19:50:51Z | [
"python",
"django",
"json",
"google-maps",
"markerclusterer"
] |
Python "Task Server" | 805,120 | <p>My question is: which python framework should I use to build my server?</p>
<p>Notes:</p>
<ul>
<li>This server talks HTTP with it's clients: GET and POST (via pyAMF)</li>
<li>Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" </li>
<li>submit and retrieve migh... | 4 | 2009-04-30T02:19:43Z | 805,126 | <p>It seems any python web framework will suit your needs. I work with a similar system on a daily basis and I can tell you, your solution with threads and SQLite for queue storage is about as simple as you're going to get. </p>
<p>Assuming order doesn't matter in your queue, then threads should be acceptable. It's im... | 0 | 2009-04-30T02:24:56Z | [
"python"
] |
Python "Task Server" | 805,120 | <p>My question is: which python framework should I use to build my server?</p>
<p>Notes:</p>
<ul>
<li>This server talks HTTP with it's clients: GET and POST (via pyAMF)</li>
<li>Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" </li>
<li>submit and retrieve migh... | 4 | 2009-04-30T02:19:43Z | 805,149 | <p>I'd suggest the following. (Since it's what we're doing.)</p>
<p>A simple WSGI server (<a href="http://docs.python.org/library/wsgiref.html" rel="nofollow">wsgiref</a> or <a href="http://werkzeug.pocoo.org/" rel="nofollow">werkzeug</a>). The HTTP requests coming in will naturally form a queue. No further queuein... | 1 | 2009-04-30T02:35:54Z | [
"python"
] |
Python "Task Server" | 805,120 | <p>My question is: which python framework should I use to build my server?</p>
<p>Notes:</p>
<ul>
<li>This server talks HTTP with it's clients: GET and POST (via pyAMF)</li>
<li>Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" </li>
<li>submit and retrieve migh... | 4 | 2009-04-30T02:19:43Z | 805,175 | <p>I'd recommend using an existing message queue. There are many to choose from (see below), and they vary in complexity and robustness. </p>
<p>Also, avoid threads: let your processing tasks run in a different process (why do they have to run in the webserver?)</p>
<p>By using an existing message queue, you only nee... | 2 | 2009-04-30T02:46:10Z | [
"python"
] |
Python "Task Server" | 805,120 | <p>My question is: which python framework should I use to build my server?</p>
<p>Notes:</p>
<ul>
<li>This server talks HTTP with it's clients: GET and POST (via pyAMF)</li>
<li>Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" </li>
<li>submit and retrieve migh... | 4 | 2009-04-30T02:19:43Z | 805,229 | <p>My reaction is to suggest Twisted, but you've already looked at this. Still, I stick by my answer. Without knowing you personal pain-points, I can at least share some things that helped me reduce almost all of the deferred-madness that arises when you have several dependent, blocking actions you need to perform fo... | 1 | 2009-04-30T03:20:11Z | [
"python"
] |
Python "Task Server" | 805,120 | <p>My question is: which python framework should I use to build my server?</p>
<p>Notes:</p>
<ul>
<li>This server talks HTTP with it's clients: GET and POST (via pyAMF)</li>
<li>Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" </li>
<li>submit and retrieve migh... | 4 | 2009-04-30T02:19:43Z | 1,556,571 | <p>You can have a look at celery</p>
| 1 | 2009-10-12T20:03:54Z | [
"python"
] |
How can I get the results of a Perl script in Python script? | 805,160 | <p>I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array.</p>
<p>Please let me know as soon as possible regarding this.</p>
| 1 | 2009-04-30T02:39:31Z | 805,185 | <p>You could serialize the results to some sort of a string format, print this to standard output in the Perl script. Then, from python call the perl script and redirect the results of stdout to a variable in python. </p>
| 2 | 2009-04-30T02:51:05Z | [
"python",
"perl"
] |
How can I get the results of a Perl script in Python script? | 805,160 | <p>I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array.</p>
<p>Please let me know as soon as possible regarding this.</p>
| 1 | 2009-04-30T02:39:31Z | 805,220 | <p>Take a look at <a href="http://pyyaml.org/" rel="nofollow">PyYAML</a> in Python and <a href="http://search.cpan.org/dist/YAML/lib/YAML.pm" rel="nofollow">YAML</a> in Perl.</p>
| 3 | 2009-04-30T03:12:25Z | [
"python",
"perl"
] |
How can I get the results of a Perl script in Python script? | 805,160 | <p>I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array.</p>
<p>Please let me know as soon as possible regarding this.</p>
| 1 | 2009-04-30T02:39:31Z | 805,226 | <p>Use the <a href="http://docs.python.org/library/subprocess.html" rel="nofollow">subprocess</a> module to run your Perl script to capture its output:</p>
<p>You can format the output however you choose in either script, and use Python to print the final report. For example: your Perl script can output XML which can... | 6 | 2009-04-30T03:15:36Z | [
"python",
"perl"
] |
How can I get the results of a Perl script in Python script? | 805,160 | <p>I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array.</p>
<p>Please let me know as soon as possible regarding this.</p>
| 1 | 2009-04-30T02:39:31Z | 808,866 | <p>Perhaps you want the answer to <a href="http://stackoverflow.com/questions/389945/how-can-i-read-perl-data-structures-from-python">How can I read Perl data structures from Python?</a>.</p>
| 2 | 2009-04-30T20:25:20Z | [
"python",
"perl"
] |
Learning Graphical Layout Algorithms | 805,356 | <p>During my day-to-day work, I tend to come across data that I want to visualize in a custom manner. For example, automatically creating a call graph similar to a UML sequence diagram, display digraphs, or visualizing data from a database (scatter plots, 3D contours, etc).</p>
<p>For graphs, I tend to use GraphViz. ... | 7 | 2009-04-30T04:39:47Z | 805,435 | <p>Here are some sources,</p>
<ul>
<li><a href="http://rads.stackoverflow.com/amzn/click/0827313748" rel="nofollow">Graphic Layout and Design (Paperback)</a>.</li>
<li><a href="http://www.hpl.hp.com/techreports/2005/HPL-2005-6R1.pdf" rel="nofollow">Active Layout Engine: Algorithms and Applications in Variable
Data Pri... | 2 | 2009-04-30T05:22:13Z | [
"c++",
"python",
"layout",
"graphics",
"visualization"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 805,419 | <p><a href="http://www.djangosnippets.org/snippets/118">Django Using Stored Procedure</a> - will give some idea. </p>
| 5 | 2009-04-30T05:13:57Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 805,423 | <p>You have to use the connection utility in Django:</p>
<pre><code>from django.db import connection
cursor = connection.cursor()
cursor.execute("SQL STATEMENT CAN BE ANYTHING")
</code></pre>
<p>then you can fetch the data:</p>
<pre><code>cursor.fetchone()
</code></pre>
<p>or:</p>
<pre><code>cursor.fetchall()
</c... | 15 | 2009-04-30T05:16:28Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 805,444 | <p>If you want to look at an actual running project that uses SP, check out <a href="https://secure.caktusgroup.com/projects/minibooks/wiki" rel="nofollow">minibooks</a>. A good deal of custom SQL and uses Postgres pl/pgsql for SP. I think they're going to remove the SP eventually though (justification in <a href="ht... | 2 | 2009-04-30T05:25:06Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 806,302 | <p>Don't.</p>
<p>Seriously.</p>
<p>Move the stored procedure logic into your model where it belongs. </p>
<p>Putting some code in Django and some code in the database is a maintenance nightmare. I've spent too many of my 30+ years in IT trying to clean up this kind of mess. </p>
| 0 | 2009-04-30T10:25:37Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 820,130 | <p>We (musicpictures.com / eviscape.com) wrote that django snippet but its not the whole story (actually that code was only tested on Oracle at that time).</p>
<p>Stored procedures make sense when you want to reuse tried and tested SP code or where one SP call will be faster than multiple calls to the database - or wh... | 15 | 2009-05-04T13:36:05Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 3,675,814 | <p>I guess the improved raw sql queryset support in Django 1.2 can make this easier as you wouldn't have to roll your own make_instance type code. </p>
| 0 | 2010-09-09T10:44:45Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
What is the best way to access stored procedures in Django's ORM | 805,393 | <p>I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? </p>
| 17 | 2009-04-30T05:03:05Z | 31,044,993 | <p>There is a good example :
<a href="https://djangosnippets.org/snippets/118/" rel="nofollow">https://djangosnippets.org/snippets/118/</a></p>
<pre><code>from django.db import connection
cursor = connection.cursor()
ret = cursor.callproc("MY_UTIL.LOG_MESSAGE", (control_in, message_in))# calls PROCEDURE named LOG_M... | 1 | 2015-06-25T08:27:15Z | [
"python",
"sql",
"django",
"stored-procedures",
"django-models"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.