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 |
|---|---|---|---|---|---|---|---|---|---|
Concatenating Dictionaries | 1,232,904 | <p>I have three lists, the first is a list of names, the second is a list of dictionaries, and the third is a list of data. Each position in a list corresponds with the same positions in the other lists. List_1[0] has corresponding data in List_2[0] and List_3[0], etc. I would like to turn these three lists into a dict... | 6 | 2009-08-05T12:22:03Z | 1,232,942 | <p>Python 3:</p>
<pre><code>combined = {name:dict(data1=List_2[i], data2=List_3[i]) for i, name in enumerate(List_1)}
</code></pre>
<p>Python 2.5:</p>
<pre><code>combined = {}
for i, name in enumerate(List_1):
combined[name] = dict(data1=List_2[i], data2=List_3[i])
</code></pre>
| 1 | 2009-08-05T12:28:07Z | [
"python",
"dictionary",
"merge",
"key"
] |
Concatenating Dictionaries | 1,232,904 | <p>I have three lists, the first is a list of names, the second is a list of dictionaries, and the third is a list of data. Each position in a list corresponds with the same positions in the other lists. List_1[0] has corresponding data in List_2[0] and List_3[0], etc. I would like to turn these three lists into a dict... | 6 | 2009-08-05T12:22:03Z | 1,234,352 | <p>if the order of these things matters, you should not use a dictionary. by definition, they are unordered. you can use one of the <a href="http://www.python.org/dev/peps/pep-0372/#reference-implementation" rel="nofollow">many ordered_dictionary implementations</a> floating around, or wait for python 2.7 or 3.1 whic... | 0 | 2009-08-05T16:33:25Z | [
"python",
"dictionary",
"merge",
"key"
] |
Python multiprocessing easy way to implement a simple counter? | 1,233,222 | <p>Hey everyone, I am using multiprocessing in python now. and I am just wondering whether there exists some sort of simple counter variable that each process when they are done processing some task could just increment ( kind of like how much work done in total).</p>
<p>I looked up the API for Value, don't think it's... | 7 | 2009-08-05T13:19:56Z | 1,233,363 | <p><code>Value</code> is indeed mutable; you specify the datatype you want from the <code>ctypes</code> module and then it can be mutated. Here's a complete, working script that demonstrates this:</p>
<pre><code>from time import sleep
from ctypes import c_int
from multiprocessing import Value, Lock, Process
counter ... | 20 | 2009-08-05T13:46:06Z | [
"python",
"multiprocessing"
] |
Hit a URL on other server from google app engine | 1,233,284 | <p>I want to hit a URL from python in google app engine. Can any one please tell me how can i hit the URL using python in google app engine. </p>
| 1 | 2009-08-05T13:32:05Z | 1,233,295 | <p>You can use the <a href="http://code.google.com/appengine/docs/python/urlfetch/overview.html" rel="nofollow">URLFetch API</a></p>
<pre><code>from google.appengine.api import urlfetch
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
doSomethingWithResult(result.content)
</... | 6 | 2009-08-05T13:34:23Z | [
"python",
"google-app-engine",
"url"
] |
Hit a URL on other server from google app engine | 1,233,284 | <p>I want to hit a URL from python in google app engine. Can any one please tell me how can i hit the URL using python in google app engine. </p>
| 1 | 2009-08-05T13:32:05Z | 1,258,042 | <p>It always depends on post or get. urllib can post to a form somewhere else, if we want the rather tricky thing validate between different hashes (sha and md5)</p>
<pre><code>import urllib
data = urllib.urlencode({"id" : str(d), "password" : self.request.POST['passwd'], "edit" : "edit"})
result = urlfet... | 0 | 2009-08-11T01:20:52Z | [
"python",
"google-app-engine",
"url"
] |
Could not import Django settings into Google App Engine | 1,233,326 | <p>Hello all you Google App Engine experts, </p>
<p>I have used Django a little before but am new to Google App Engine and
am trying to use it's development web server with Django for the first time. </p>
<p>I don't know if this is relevent but I previously had Django 1.1 and
Python 2.6 on my Windows XP and even th... | 0 | 2009-08-05T13:40:06Z | 1,424,757 | <p>I had a similar problem and I put an empty settings.py file in my root directory and it worked.</p>
<p>Good Luck</p>
| 2 | 2009-09-15T01:59:06Z | [
"python",
"django",
"google-app-engine"
] |
Could not import Django settings into Google App Engine | 1,233,326 | <p>Hello all you Google App Engine experts, </p>
<p>I have used Django a little before but am new to Google App Engine and
am trying to use it's development web server with Django for the first time. </p>
<p>I don't know if this is relevent but I previously had Django 1.1 and
Python 2.6 on my Windows XP and even th... | 0 | 2009-08-05T13:40:06Z | 1,648,228 | <p>for local testing add these at the start of your main.py</p>
<pre><code>import os, sys
os.environ["DJANGO_SETTINGS_MODULE"] = "appid.settings"
sys.path.append("/app/folder")
</code></pre>
| 1 | 2009-10-30T05:57:53Z | [
"python",
"django",
"google-app-engine"
] |
Could not import Django settings into Google App Engine | 1,233,326 | <p>Hello all you Google App Engine experts, </p>
<p>I have used Django a little before but am new to Google App Engine and
am trying to use it's development web server with Django for the first time. </p>
<p>I don't know if this is relevent but I previously had Django 1.1 and
Python 2.6 on my Windows XP and even th... | 0 | 2009-08-05T13:40:06Z | 3,184,944 | <p>How are you developing the application using Django and google application engine? </p>
<p>If you are using Django, settings.py should already be there. </p>
<p>Tyr <a href="http://code.google.com/p/app-engine-patch/" rel="nofollow">App engine patch</a></p>
<p>it provides a good starting point to develop the appl... | 0 | 2010-07-06T09:15:02Z | [
"python",
"django",
"google-app-engine"
] |
Could not import Django settings into Google App Engine | 1,233,326 | <p>Hello all you Google App Engine experts, </p>
<p>I have used Django a little before but am new to Google App Engine and
am trying to use it's development web server with Django for the first time. </p>
<p>I don't know if this is relevent but I previously had Django 1.1 and
Python 2.6 on my Windows XP and even th... | 0 | 2009-08-05T13:40:06Z | 4,800,327 | <p>I started getting these problems after adding appengine_config.py to my project. On the file I had incorrect path for settings (just settings, even though I should have had myproj.settings)</p>
<pre><code>os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'
</code></pre>
<p>"Interesting" twist was that when ev... | 0 | 2011-01-26T00:20:02Z | [
"python",
"django",
"google-app-engine"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 1,233,509 | <p>Look at the following:</p>
<pre><code>map(multilambda x:
y=x+1
return y
, [1,2,3])
</code></pre>
<p>Is this a lambda returning <code>(y, [1,2,3])</code> (thus map only gets one parameter, resulting in an error)? Or does it return <code>y</code>? Or is it a syntax error, because the comma on the new ... | 75 | 2009-08-05T14:10:30Z | [
"python",
"syntax",
"lambda"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 1,233,520 | <p>Guido van Rossum (the inventor of Python) answers this exact question himself in <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=147358">an old blog post</a>.<br>
Basically, he admits that it's theoretically possible, but that any proposed solution would be un-Pythonic:</p>
<blockquote>
<p>"But the com... | 300 | 2009-08-05T14:12:30Z | [
"python",
"syntax",
"lambda"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 1,233,611 | <p>A couple of relevant links:</p>
<p>For a while, I was following the development of Reia, which was initially going to have Python's indentation based syntax with Ruby blocks too, all on top of Erlang. But, the designer wound up giving up on indentation sensitivity, and this post he wrote about that decision inclu... | 12 | 2009-08-05T14:27:04Z | [
"python",
"syntax",
"lambda"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 13,672,943 | <p>This is generally very ugly (but sometimes the alternatives are even more ugly), so a workaround is to make a braces expression:</p>
<pre><code>lambda: (
doFoo('abc'),
doBar(123),
doBaz())
</code></pre>
<p>It won't accept any assignments though, so you'll have to prepare data beforehand.
The place I fo... | 14 | 2012-12-02T19:32:22Z | [
"python",
"syntax",
"lambda"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 18,996,338 | <p>Let me try to tackle @balpha parsing problem. I would use parentheses around the multiline lamda. If there is no parentheses, the lambda definition is greedy. So the lambda in </p>
<pre><code>map(lambda x:
y = x+1
z = x-1
y*z,
[1,2,3]))
</code></pre>
<p>returns a function that returns <code>(... | 5 | 2013-09-25T04:39:24Z | [
"python",
"syntax",
"lambda"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 26,210,269 | <p>A workaround to get multiline lambda functions (an extension to skriticos's answer):</p>
<pre><code>(lambda n: (exec('global x; x=4; x=x+n'), x-2)[-1])(0)
</code></pre>
<p><strong>What it does:</strong></p>
<ul>
<li><p>Python simplifies (executes) every component of a tuple before
reading the delimiters.</p></li>... | 2 | 2014-10-06T05:03:37Z | [
"python",
"syntax",
"lambda"
] |
No Multiline Lambda in Python: Why not? | 1,233,448 | <p>I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and realized I couldn't think of a single Python construct that multiline lambdas clash with. Given that I know the langua... | 129 | 2009-08-05T14:00:30Z | 34,741,858 | <p>(For anyone still interested in the topic.)</p>
<p>Consider this (includes even usage of statements' return values in further statements within the "multiline" lambda, although it's ugly to the point of vomiting ;-)</p>
<pre><code>>>> def foo(arg):
... result = arg * 2;
... print "foo(" + str(arg)... | 2 | 2016-01-12T10:59:50Z | [
"python",
"syntax",
"lambda"
] |
Python Dictionary to URL Parameters | 1,233,539 | <p>I am trying to convert a Python dictionary to a string for use as URL parameters. I am sure that there is a better, more <a href="http://en.wikipedia.org/wiki/Pythonic">Pythonic</a> way of doing this. What is it?</p>
<pre><code>x = ""
for key, val in {'a':'A', 'b':'B'}.items():
x += "%s=%s&" %(key,val)
x = ... | 64 | 2009-08-05T14:14:06Z | 1,233,551 | <p>Use <a href="http://docs.python.org/library/urllib.html#urllib.urlencode"><code>urllib.urlencode()</code></a>. It takes a dictionary of key-value pairs, and converts it into a form suitable for a URL (e.g., <code>key1=val1&key2=val2</code>).</p>
<p>If you are using Python3, use <a href="https://docs.python.org/... | 128 | 2009-08-05T14:16:28Z | [
"python",
"dictionary",
"url-parameters"
] |
PYTHON: Converting list of tuples into a dictionary | 1,233,546 | <p>I'm looking for a way to convert <strong>list of tuples</strong> which looks like this:</p>
<pre><code>[(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
</code></pre>
<p>into <strong>a dictionary</strong>, where key:value pair looks like this:</p>
<pre><code>{4:[1,2,3] ,15:[4,5... | 30 | 2009-08-05T14:15:49Z | 1,233,573 | <pre><code>l = [(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
d = {}
for v, k in l:
d.setdefault(k, []).append(v)
</code></pre>
| 2 | 2009-08-05T14:19:43Z | [
"python",
"list",
"dictionary"
] |
PYTHON: Converting list of tuples into a dictionary | 1,233,546 | <p>I'm looking for a way to convert <strong>list of tuples</strong> which looks like this:</p>
<pre><code>[(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
</code></pre>
<p>into <strong>a dictionary</strong>, where key:value pair looks like this:</p>
<pre><code>{4:[1,2,3] ,15:[4,5... | 30 | 2009-08-05T14:15:49Z | 1,233,587 | <pre><code>tuples = [(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
dicts = {}
for elem in tuples:
try:
dicts[elem[1]].append(elem[0])
except KeyError:
dicts[elem[1]] = [elem[0],]
</code></pre>
| 2 | 2009-08-05T14:22:25Z | [
"python",
"list",
"dictionary"
] |
PYTHON: Converting list of tuples into a dictionary | 1,233,546 | <p>I'm looking for a way to convert <strong>list of tuples</strong> which looks like this:</p>
<pre><code>[(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
</code></pre>
<p>into <strong>a dictionary</strong>, where key:value pair looks like this:</p>
<pre><code>{4:[1,2,3] ,15:[4,5... | 30 | 2009-08-05T14:15:49Z | 1,233,588 | <pre><code>>>> a = [(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
>>> b = {}
>>> for i, j in a:
... b.setdefault(j, []).append(i)
...
>>> b
{23: [6, 7, 8, 10], 4: [1, 2, 3], 15: [4, 5, 9, 11, 12]}
>>>
</code></pre>
| 12 | 2009-08-05T14:22:30Z | [
"python",
"list",
"dictionary"
] |
PYTHON: Converting list of tuples into a dictionary | 1,233,546 | <p>I'm looking for a way to convert <strong>list of tuples</strong> which looks like this:</p>
<pre><code>[(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
</code></pre>
<p>into <strong>a dictionary</strong>, where key:value pair looks like this:</p>
<pre><code>{4:[1,2,3] ,15:[4,5... | 30 | 2009-08-05T14:15:49Z | 1,233,617 | <p>This will do:</p>
<pre><code>from collections import defaultdict
def to_list_of_dicts(list_of_tuples):
d = defaultdict(list)
for x, y in list_of_tuples:
d[y].append(x)
return sorted([{x: y} for (x, y) in d.items()])
</code></pre>
| 2 | 2009-08-05T14:27:40Z | [
"python",
"list",
"dictionary"
] |
PYTHON: Converting list of tuples into a dictionary | 1,233,546 | <p>I'm looking for a way to convert <strong>list of tuples</strong> which looks like this:</p>
<pre><code>[(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
</code></pre>
<p>into <strong>a dictionary</strong>, where key:value pair looks like this:</p>
<pre><code>{4:[1,2,3] ,15:[4,5... | 30 | 2009-08-05T14:15:49Z | 1,233,628 | <pre><code>>>> from collections import defaultdict
>>> l= [(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
>>> d= defaultdict( list )
>>> for v, k in l:
... d[k].append(v)
...
>>> d
defaultdict(<type 'list'>, {23: [6, 7, 8, 10]... | 41 | 2009-08-05T14:29:46Z | [
"python",
"list",
"dictionary"
] |
PYTHON: Converting list of tuples into a dictionary | 1,233,546 | <p>I'm looking for a way to convert <strong>list of tuples</strong> which looks like this:</p>
<pre><code>[(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
</code></pre>
<p>into <strong>a dictionary</strong>, where key:value pair looks like this:</p>
<pre><code>{4:[1,2,3] ,15:[4,5... | 30 | 2009-08-05T14:15:49Z | 3,632,691 | <p>It's not fancy but it is simple</p>
<pre><code>l = [(1,4),(2,4),(3,4),(4,15),(5,15),(6,23),(7,23),(8,23),(9,15),(10,23),(11,15),(12,15)]
d = dict((k, [i[0] for i in l if i[1] == k]) for k in frozenset(j[1] for j in l))
</code></pre>
<p>Huzzah!</p>
| 2 | 2010-09-03T02:24:46Z | [
"python",
"list",
"dictionary"
] |
k-means clustering implementation in python, running out of memory | 1,233,593 | <h3>Â Note: updates/solutions at the bottom of this question</h3>
<p>As part of a product recommendation engine, I'm trying to segment my users based on their product preferences starting with using the k-means clustering algorithm.</p>
<p>My data is a dictionary of the form:</p>
<pre><code>prefs = {
'user_id_1'... | 6 | 2009-08-05T14:24:04Z | 1,234,525 | <p>Your <code>centroids</code> does not need to be an actual list.</p>
<p>You never appear to reference anything other than <code>centroids[i][m]</code>. If you only want <code>centroids[i]</code>, then perhaps it doesn't need to be a list; a simple dictionary would probably do.</p>
<pre><code> centroids = defaul... | 0 | 2009-08-05T17:05:27Z | [
"python"
] |
k-means clustering implementation in python, running out of memory | 1,233,593 | <h3>Â Note: updates/solutions at the bottom of this question</h3>
<p>As part of a product recommendation engine, I'm trying to segment my users based on their product preferences starting with using the k-means clustering algorithm.</p>
<p>My data is a dictionary of the form:</p>
<pre><code>prefs = {
'user_id_1'... | 6 | 2009-08-05T14:24:04Z | 1,234,620 | <p>Not all these observations are directly relevant to your issues as expressed, but..:</p>
<p>a. why are the key in prefs, as shown, longs? unless you have billions of users, simple ints will be fine and save you a little memory.</p>
<p>b. your code:</p>
<pre><code>centroids = [prefs[random.choice(users)] for i in ... | 6 | 2009-08-05T17:23:39Z | [
"python"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 1,233,729 | <p>Your definition of "simplest" is important here - simple code means using a module (though "large external library" is an exaggeration).</p>
<p>I believe the most up-to-date (actively developed) module is <a href="http://www.lag.net/paramiko/">paramiko</a>. It comes with demo scripts in the download, and has detail... | 8 | 2009-08-05T14:44:49Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 1,233,763 | <p>I haven't tried it, but this <a href="http://pypi.python.org/pypi/pysftp/" rel="nofollow">pysftp</a> module might help, which in turn uses paramiko. I believe everything is client-side.</p>
<p>The interesting command is probably <code>.execute()</code> which executes an arbitrary command on the remote machine. (The... | 37 | 2009-08-05T14:49:05Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 1,233,845 | <p>You can code it yourself using Paramiko, as suggested above. Alternatively, you can look into Fabric, a python application for doing all the things you asked about:</p>
<blockquote>
<p>Fabric is a Python library and
command-line tool designed to
streamline deploying applications or
performing system adminis... | 59 | 2009-08-05T15:00:29Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 1,233,872 | <p>If you want to avoid any extra modules, you can use the subprocess module to run</p>
<pre><code>ssh [host] [command]
</code></pre>
<p>and capture the output. </p>
<p>Try something like:</p>
<pre><code>process = subprocess.Popen("ssh example.com ls", shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOU... | 21 | 2009-08-05T15:05:39Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 1,238,024 | <p>Like hughdbrown, I like Fabric. Please notice that while it implement its own declarative scripting (for making deploys and the such) it can also be imported as a Python module and used on your programs without having to write a Fabric script.</p>
<p>Fabric has a new maintainer and is in the process of being rewrit... | 6 | 2009-08-06T10:08:26Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 5,142,224 | <p>I have written <a href="http://www.no-ack.org/2010/11/python-bindings-for-libssh2.html">Python bindings for libssh2</a>. Libssh2 is a client-side library implementing the SSH2 protocol.</p>
<pre><code>import socket
import libssh2
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('exmaple.com',... | 15 | 2011-02-28T12:51:11Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 14,267,862 | <p>I found paramiko to be a bit too low-level, and Fabric not especially well-suited to being used as a library, so I put together my own library called <a href="http://pypi.python.org/pypi/spur">spur</a> that uses paramiko to implement a slightly nicer interface:</p>
<pre><code>import spur
shell = spur.SshShell(host... | 6 | 2013-01-10T21:47:55Z | [
"python",
"linux",
"unix",
"ssh"
] |
What is the simplest way to SSH using Python? | 1,233,655 | <p>How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console?</p>
<p>I would rather not use any large external library or install anything on the remote server.</p>
| 73 | 2009-08-05T14:34:25Z | 34,411,796 | <p>This worked for me</p>
<pre><code>import subprocess
import sys
HOST="IP"
COMMAND="ifconfig"
def passwordless_ssh(HOST):
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
... | 1 | 2015-12-22T08:51:39Z | [
"python",
"linux",
"unix",
"ssh"
] |
Installing Pinax on Windows | 1,233,670 | <p>Can I install <a href="http://pinaxproject.com/" rel="nofollow">Pinax</a> on Windows Environment?
Is there a easy way?
Which environment do you recommend?</p>
| 4 | 2009-08-05T14:36:04Z | 1,233,982 | <p>Provided you have Python and Django installed, Pinax should install fine. According to the documentation there is one step that you have to do specifically on Windows however (Under the "Note To Windows Users" heading):</p>
<p><a href="http://pinaxproject.com/docs/0.5.1/install.html" rel="nofollow">http://pinaxpro... | 0 | 2009-08-05T15:24:48Z | [
"python",
"django",
"web-applications",
"pinax"
] |
Installing Pinax on Windows | 1,233,670 | <p>Can I install <a href="http://pinaxproject.com/" rel="nofollow">Pinax</a> on Windows Environment?
Is there a easy way?
Which environment do you recommend?</p>
| 4 | 2009-08-05T14:36:04Z | 1,234,266 | <p>I spent a while trying to get the .7 beta working in Windows and ran into a lot of trouble. However, it looks like the 3rd beta release of .7 (the latest beta release) focuses on Windows support. So try that, instead of the 'stable' version - it's close to being released as stable anyway, and is recommended now for ... | 0 | 2009-08-05T16:17:05Z | [
"python",
"django",
"web-applications",
"pinax"
] |
Installing Pinax on Windows | 1,233,670 | <p>Can I install <a href="http://pinaxproject.com/" rel="nofollow">Pinax</a> on Windows Environment?
Is there a easy way?
Which environment do you recommend?</p>
| 4 | 2009-08-05T14:36:04Z | 1,416,015 | <p>I have pinax 0.7rc1 installed and working on windows 7, with no problems.</p>
<p>Check out this video for a great example on how to do this. He uses pinax 0.7beta3 on windows XP.</p>
<p><a href="http://www.vimeo.com/6098872" rel="nofollow">http://www.vimeo.com/6098872</a></p>
<p>Here are the steps I followed.</p>... | 7 | 2009-09-12T20:13:08Z | [
"python",
"django",
"web-applications",
"pinax"
] |
Django ManyToMany Template Questions | 1,233,709 | <p>Good Morning All,</p>
<p>I've been a PHP programmer for quite some time, but I've felt the need to move more towards the Python direction and what's better than playing around with Django.</p>
<p>While in the process, I'm come to a stopping point where I know there is an easy solution, but I'm just missing it - Ho... | 3 | 2009-08-05T14:42:13Z | 1,233,737 | <p>From what I can see, I think you've got a small syntax error:</p>
<pre><code>{% photo.image %}
</code></pre>
<p>should instead be:</p>
<pre><code>{{ photo.image }}
</code></pre>
<p>The <code>{% %}</code> notation is used for django template tags. Variables, on the other hand, are expressed with the <code>{{ }}</... | 3 | 2009-08-05T14:45:43Z | [
"python",
"django",
"templates",
"django-templates",
"many-to-many"
] |
PyQt : why adding a dummy class definition in my file make the application crash? | 1,233,711 | <p>Consider the code below:</p>
<pre><code> #!/usr/bin/env python
from PyQt4 import QtCore, QtGui
import os,sys
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.listWidget = QtGui.QListWidget(None)
self.setCentralWidg... | 0 | 2009-08-05T14:42:39Z | 1,233,760 | <p>I have not worked with PyQt before, but didn't you forget to call the constructor of the superclass here? </p>
<pre><code>class MyWidget(QtGui.QWidget):
def __init__(self):
# Where is the call to QtGui.QWidget's init ?
pass
</code></pre>
| 0 | 2009-08-05T14:48:47Z | [
"python",
"pyqt4"
] |
PyQt : why adding a dummy class definition in my file make the application crash? | 1,233,711 | <p>Consider the code below:</p>
<pre><code> #!/usr/bin/env python
from PyQt4 import QtCore, QtGui
import os,sys
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.listWidget = QtGui.QListWidget(None)
self.setCentralWidg... | 0 | 2009-08-05T14:42:39Z | 1,234,122 | <p>Can't reproduce the problem as reported: the following exact code</p>
<pre><code>from PyQt4 import QtCore, QtGui
import os, sys
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.listWidget = QtGui.QListWidget(None)
sel... | 1 | 2009-08-05T15:49:39Z | [
"python",
"pyqt4"
] |
python sub-process | 1,233,728 | <p>I usually execute a Fortran file in Linux (manually) as:</p>
<ol>
<li>Connect to the server</li>
<li>Go to the specific folder</li>
<li><code>ifort xxx.for -o xxx && ./xxx</code> (where 'xxx.for' is my Fortran file and 'xxx' is Fortran executable file)</li>
</ol>
<p>But I need to call my fortran file (xxx.... | 5 | 2009-08-05T14:44:40Z | 1,233,801 | <p>do you have to use python?</p>
<p>ssh user@host "command"</p>
| 0 | 2009-08-05T14:54:11Z | [
"python",
"ssh",
"subprocess"
] |
python sub-process | 1,233,728 | <p>I usually execute a Fortran file in Linux (manually) as:</p>
<ol>
<li>Connect to the server</li>
<li>Go to the specific folder</li>
<li><code>ifort xxx.for -o xxx && ./xxx</code> (where 'xxx.for' is my Fortran file and 'xxx' is Fortran executable file)</li>
</ol>
<p>But I need to call my fortran file (xxx.... | 5 | 2009-08-05T14:44:40Z | 1,233,808 | <p>For the manual part you may want to look into <a href="http://pexpect.sourceforge.net/pexpect.html" rel="nofollow">pexpect</a> or for windows <a href="http://sage.math.washington.edu/home/goreckc/sage/wexpect/" rel="nofollow">wexpect</a>. These allow you to perform subprocesses and pass input under interactive condi... | 2 | 2009-08-05T14:55:28Z | [
"python",
"ssh",
"subprocess"
] |
python sub-process | 1,233,728 | <p>I usually execute a Fortran file in Linux (manually) as:</p>
<ol>
<li>Connect to the server</li>
<li>Go to the specific folder</li>
<li><code>ifort xxx.for -o xxx && ./xxx</code> (where 'xxx.for' is my Fortran file and 'xxx' is Fortran executable file)</li>
</ol>
<p>But I need to call my fortran file (xxx.... | 5 | 2009-08-05T14:44:40Z | 1,233,847 | <p>one error:<br>
you have an unquoted %s in your list of args, so your string formatting will fail.</p>
| 1 | 2009-08-05T15:01:13Z | [
"python",
"ssh",
"subprocess"
] |
python sub-process | 1,233,728 | <p>I usually execute a Fortran file in Linux (manually) as:</p>
<ol>
<li>Connect to the server</li>
<li>Go to the specific folder</li>
<li><code>ifort xxx.for -o xxx && ./xxx</code> (where 'xxx.for' is my Fortran file and 'xxx' is Fortran executable file)</li>
</ol>
<p>But I need to call my fortran file (xxx.... | 5 | 2009-08-05T14:44:40Z | 1,233,854 | <p>there are some syntax errors...</p>
<p>original:</p>
<pre><code>cmd=["ssh", sshConnect, "cd %s;"%(workDir), Fortrancmd %s jobname "%s -o %s" exeFilename "%s && %s ./ %s%s"%(exeFilename)]
</code></pre>
<p>I think you mean:</p>
<pre><code>cmd = [
"ssh",
sshConnect,
"cd %s;" % (workDir,),... | 3 | 2009-08-05T15:03:35Z | [
"python",
"ssh",
"subprocess"
] |
python sub-process | 1,233,728 | <p>I usually execute a Fortran file in Linux (manually) as:</p>
<ol>
<li>Connect to the server</li>
<li>Go to the specific folder</li>
<li><code>ifort xxx.for -o xxx && ./xxx</code> (where 'xxx.for' is my Fortran file and 'xxx' is Fortran executable file)</li>
</ol>
<p>But I need to call my fortran file (xxx.... | 5 | 2009-08-05T14:44:40Z | 1,800,837 | <p>Here is a complete example of using the subprocess module to run a remote command via ssh (a simple echo in this case) and grab the results, hope it helps:</p>
<pre><code>>>> import subprocess
>>> proc = subprocess.Popen(("ssh", "remoteuser@host", "echo", "1"), stdout=subprocess.PIPE, stderr=subpr... | 1 | 2009-11-26T00:10:40Z | [
"python",
"ssh",
"subprocess"
] |
python sub-process | 1,233,728 | <p>I usually execute a Fortran file in Linux (manually) as:</p>
<ol>
<li>Connect to the server</li>
<li>Go to the specific folder</li>
<li><code>ifort xxx.for -o xxx && ./xxx</code> (where 'xxx.for' is my Fortran file and 'xxx' is Fortran executable file)</li>
</ol>
<p>But I need to call my fortran file (xxx.... | 5 | 2009-08-05T14:44:40Z | 10,364,583 | <p>You could use <a href="http://docs.fabfile.org" rel="nofollow">fabric</a> for steps 1 and 2.
This is the basic idea:</p>
<pre><code>from fabric.api import *
env.hosts = ['host']
dir = '/home/...'
def compile(file):
with cd(dir):
run("ifort %s.for -o %s" % file)
run("./%s > stdout.txt" % f... | 1 | 2012-04-28T14:49:18Z | [
"python",
"ssh",
"subprocess"
] |
PIL does not save transparency | 1,233,772 | <pre><code>from PIL import Image
img = Image.open('1.png')
img.save('2.png')
</code></pre>
<p>The first image has a transparent background, but when I save it, the transparency is gone (background is white)</p>
<p>What am I doing wrong?</p>
| 9 | 2009-08-05T14:50:26Z | 1,233,807 | <p>Probably the image is indexed (mode "P" in PIL), so the transparency is not set in PNG alpha channel, but in metadata info.</p>
<p>You can get transparent background palette index with the following code:</p>
<pre><code>from PIL import Image
img = Image.open('1.png')
png_info = img.info
img.save('2.png', **png_in... | 28 | 2009-08-05T14:55:20Z | [
"python",
"png",
"python-imaging-library"
] |
PIL does not save transparency | 1,233,772 | <pre><code>from PIL import Image
img = Image.open('1.png')
img.save('2.png')
</code></pre>
<p>The first image has a transparent background, but when I save it, the transparency is gone (background is white)</p>
<p>What am I doing wrong?</p>
| 9 | 2009-08-05T14:50:26Z | 1,234,048 | <p>You can always force the the type to "RGBA",</p>
<pre><code>img = Image.open('1.png')
img.convert('RGBA')
img.save('2.png')
</code></pre>
| 2 | 2009-08-05T15:38:30Z | [
"python",
"png",
"python-imaging-library"
] |
How long do zipimported module imports remain cached in memory when using appengine / python and is there a way to keep them in memory? | 1,233,826 | <p>I've recently uploaded an app that uses django appengine patch and currently have a cron job that runs every two minutes. On each invocation of the worker url it consumes quite a bit of resources </p>
<pre><code>/worker_url 200 7633ms 34275cpu_ms 28116api_ms
</code></pre>
<p>That is because on each invocation it ... | 1 | 2009-08-05T14:58:29Z | 1,233,996 | <p>app engine keeps everything in memory according to normal Python semantics as long as it's serving one or more requests in the same process in the same node; if and when it needs those resources, the process goes away (so nothing stays in memory that it used to have), and new processes may be started (on the same no... | 1 | 2009-08-05T15:27:31Z | [
"python",
"django",
"google-app-engine",
"import"
] |
In GTK, how do I get the actual size of a widget on screen? | 1,234,223 | <p>First I looked at the <code>get_size_request</code> method. The docs there end with:</p>
<blockquote>
<p>To get the size a widget will actually use, call the <code>size_request()</code> instead of this method.</p>
</blockquote>
<p>I look at <code>size_request()</code>, and it ends with </p>
<blockquote>
<p>Al... | 5 | 2009-08-05T16:09:08Z | 1,234,294 | <p>This should be it (took some time to find):</p>
<blockquote>
<p>The get_allocation() method returns a gtk.gdk.Rectangle containing the bounds of the widget's allocation.</p>
</blockquote>
<p>From <a href="http://library.gnome.org/devel/pygtk/stable/class-gtkwidget.html#method-gtkwidget--get-allocation">here</a>.... | 9 | 2009-08-05T16:23:46Z | [
"python",
"api",
"user-interface",
"gtk",
"pygtk"
] |
In Twisted Python - Make sure a protocol instance would be completely deallocated | 1,234,292 | <p>I have a pretty intensive chat socket server written in Twisted Python, I start it using internet.TCPServer with a factory and that factory references to a protocol object that handles all communications with the client.</p>
<p>How should I make sure a protocol instance completely destroys itself once a client has ... | 4 | 2009-08-05T16:23:16Z | 1,236,382 | <p>ok, for sorting out this issue I have set a <code>__del__</code> method in the protocol class and I am now logging protocol instances that have not been garbage collected within 1 minute from the time the client has disconnected. </p>
<p>If anybody has any better solution I'll still be glad to hear about it but so ... | -1 | 2009-08-06T00:14:22Z | [
"python",
"sockets",
"twisted",
"twisted.words"
] |
Introspecting a given function's nested (local) functions in Python | 1,234,672 | <p>Given the function</p>
<pre><code>def f():
x, y = 1, 2
def get():
print 'get'
def post():
print 'post'
</code></pre>
<p>is there a way for me to access its local get() and post() functions in a way that I can call them? I'm looking for a function that will work like so with the functi... | 5 | 2009-08-05T17:36:15Z | 1,234,689 | <p>You can return functions just like any other object in Python:</p>
<pre><code>def f():
x, y = 1, 2
def get():
print 'get'
def post():
print 'post'
return (get, post)
get, post = f()
</code></pre>
<p>Hope this helps!</p>
<p>Note, though, that if you want to use your 'x' and 'y' v... | 2 | 2009-08-05T17:43:38Z | [
"python",
"function",
"introspection",
"inspect"
] |
Introspecting a given function's nested (local) functions in Python | 1,234,672 | <p>Given the function</p>
<pre><code>def f():
x, y = 1, 2
def get():
print 'get'
def post():
print 'post'
</code></pre>
<p>is there a way for me to access its local get() and post() functions in a way that I can call them? I'm looking for a function that will work like so with the functi... | 5 | 2009-08-05T17:36:15Z | 1,234,756 | <p>You could use exec to run the code objects. For example, if you had f defined as above, then</p>
<pre><code>exec(f.func_code.co_consts[3])
</code></pre>
<p>would give </p>
<pre><code>get
</code></pre>
<p>as output. </p>
| 2 | 2009-08-05T17:57:21Z | [
"python",
"function",
"introspection",
"inspect"
] |
Introspecting a given function's nested (local) functions in Python | 1,234,672 | <p>Given the function</p>
<pre><code>def f():
x, y = 1, 2
def get():
print 'get'
def post():
print 'post'
</code></pre>
<p>is there a way for me to access its local get() and post() functions in a way that I can call them? I'm looking for a function that will work like so with the functi... | 5 | 2009-08-05T17:36:15Z | 1,235,642 | <p>The inner function objects don't exist before the function f() is executed. If you want to get them you'll have to construct them yourself. That is definitely non-trivial because they might be closures that capture variables from the scope of the function and will anyway require poking around in objects that should ... | 1 | 2009-08-05T20:45:10Z | [
"python",
"function",
"introspection",
"inspect"
] |
Introspecting a given function's nested (local) functions in Python | 1,234,672 | <p>Given the function</p>
<pre><code>def f():
x, y = 1, 2
def get():
print 'get'
def post():
print 'post'
</code></pre>
<p>is there a way for me to access its local get() and post() functions in a way that I can call them? I'm looking for a function that will work like so with the functi... | 5 | 2009-08-05T17:36:15Z | 1,235,801 | <p>You are pretty close of doing that - just missing <code>new</code> module:</p>
<pre><code>import inspect
import new
def f():
x, y = 1, 2
def get():
print 'get'
def post():
print 'post'
for c in f.func_code.co_consts:
if inspect.iscode(c):
f = new.function(c, globals())
... | 4 | 2009-08-05T21:15:39Z | [
"python",
"function",
"introspection",
"inspect"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 1,236,347 | <p>The source to Cheese Shop can be downloaded from <a href="https://bitbucket.org/pypa/pypi/src" rel="nofollow">https://bitbucket.org/pypa/pypi/src</a>. There is also an example, from the page you linked to, of using Apache as a "dumb" Python package repository:</p>
<pre><code># Mount pypi repositories into URI space... | 12 | 2009-08-06T00:00:39Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 1,468,293 | <p>If you would like a lighter solution then deploying an entire pypi server, you could try using a server index generated by <a href="http://pypi.python.org/pypi/basketweaver" rel="nofollow">basketweaver</a>.</p>
| 2 | 2009-09-23T20:14:59Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 12,632,065 | <p>Updated: crate.io has shut down and the domain is now something else entirely.</p>
<p>One project that hasn't been mentioned is <a href="https://crate.io/" rel="nofollow">https://crate.io/</a>, which seems very active. It claims to be a "Next Generation Python Packaging Index", but they have their repositories spli... | 3 | 2012-09-28T00:40:53Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 12,874,682 | <p>For light-weight solution, use <a href="http://pypi.python.org/pypi/pypiserver">pypiserver</a>. </p>
| 12 | 2012-10-13T15:46:42Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 14,475,708 | <p>Another missing from this (oldish) list: </p>
<h2><a href="https://github.com/benliles/djangopypi" rel="nofollow">djangopypi</a></h2>
<p>Django based, which might be a slight overkill, but I love django and it makes it extremely simple to modify it to your need should it not be satisfying.</p>
| 0 | 2013-01-23T08:57:02Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 14,475,827 | <p>And crate source code is available, though documentation is, least that can be said, not-existent:</p>
<p><strong><a href="https://github.com/crateio/crate.web" rel="nofollow">Crate.Web</a></strong></p>
<p>It's a Django Application providing a Python Package Index. Uses a couple other packages from <a href="https:... | 0 | 2013-01-23T09:04:00Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 19,236,106 | <p>There is a fork of djangopypi named djangopypi2 you can get it from <a href="https://github.com/popen2/djangopypi2/" rel="nofollow">https://github.com/popen2/djangopypi2/</a>, I installed it and works for me, this option is what I had choose from a list of about 24 alternatives that I have found in a recently search... | 3 | 2013-10-07T22:46:04Z | [
"python",
"pypi"
] |
How to roll my own pypi? | 1,235,331 | <p>I would like to run my own internal pypi server, for egg distribution within my organization.</p>
<p>I have found a few projects, such as: </p>
<ul>
<li><a href="http://pypi.python.org/pypi/EggBasket/">http://pypi.python.org/pypi/EggBasket/</a></li>
<li><a href="http://plone.org/products/plonesoftwarecenter">http:... | 36 | 2009-08-05T19:43:35Z | 21,519,926 | <p>I ran into the same problem, and <a href="https://pypi.python.org/pypi/ClueReleaseManager" rel="nofollow">ClueReleaseManager</a> solved the problem of hosting an internal PyPI server/custom Python repository for me. </p>
<p>That answers question two, and I guess you already have the answer to question one.</p>
| 0 | 2014-02-03T04:53:45Z | [
"python",
"pypi"
] |
Python: how can I handle any unhandled exception in an alternative way? | 1,235,349 | <p>Normally unhandled exceptions go to the stdout (or stderr?), I am building an app where I want to pass this info to the GUI before shutting down and display it to the user and, at the same time I want to write it to a log file. So, I need an str with the full text of the exception.</p>
<p>How can I do this?</p>
| 6 | 2009-08-05T19:46:05Z | 1,235,378 | <pre><code>try:
# blah blah The Main Loop, function, whatever...
except e:
do_something_with(str(e))
</code></pre>
| 0 | 2009-08-05T19:52:24Z | [
"python",
"exception"
] |
Python: how can I handle any unhandled exception in an alternative way? | 1,235,349 | <p>Normally unhandled exceptions go to the stdout (or stderr?), I am building an app where I want to pass this info to the GUI before shutting down and display it to the user and, at the same time I want to write it to a log file. So, I need an str with the full text of the exception.</p>
<p>How can I do this?</p>
| 6 | 2009-08-05T19:46:05Z | 1,235,428 | <pre><code>import sys, logging
logging.basicConfig(filename='/path/to/log/file', filemode='w')
...
try:
your_code_here()
except:
logging.exception("My code failed") # logs exception to file
# you define display_exception_in_ui as "def display_exception_in_ui(exc, tb):"
display_exception_in_ui(*sys.exc... | 2 | 2009-08-05T20:00:55Z | [
"python",
"exception"
] |
Python: how can I handle any unhandled exception in an alternative way? | 1,235,349 | <p>Normally unhandled exceptions go to the stdout (or stderr?), I am building an app where I want to pass this info to the GUI before shutting down and display it to the user and, at the same time I want to write it to a log file. So, I need an str with the full text of the exception.</p>
<p>How can I do this?</p>
| 6 | 2009-08-05T19:46:05Z | 1,235,434 | <p>Use sys.excepthook to replace the base exception handler. You can do something like:</p>
<pre><code>import sys
from PyQt4 import QtGui
import os.path
import traceback
def handle_exception(exc_type, exc_value, exc_traceback):
""" handle all exceptions """
## KeyboardInterrupt is a special case.
## We don't... | 13 | 2009-08-05T20:02:35Z | [
"python",
"exception"
] |
Python: how can I handle any unhandled exception in an alternative way? | 1,235,349 | <p>Normally unhandled exceptions go to the stdout (or stderr?), I am building an app where I want to pass this info to the GUI before shutting down and display it to the user and, at the same time I want to write it to a log file. So, I need an str with the full text of the exception.</p>
<p>How can I do this?</p>
| 6 | 2009-08-05T19:46:05Z | 1,236,614 | <p>You already got excellent answers, I just wanted to add one more tip that's served me well over the years in a variety of language for the specific problem "how to cleanly diagnose, log, etc, <code>out of memory</code> errors?". Problem is, if your code gets control before enough objects have been destroyed and the... | 8 | 2009-08-06T02:01:42Z | [
"python",
"exception"
] |
Python: how can I handle any unhandled exception in an alternative way? | 1,235,349 | <p>Normally unhandled exceptions go to the stdout (or stderr?), I am building an app where I want to pass this info to the GUI before shutting down and display it to the user and, at the same time I want to write it to a log file. So, I need an str with the full text of the exception.</p>
<p>How can I do this?</p>
| 6 | 2009-08-05T19:46:05Z | 32,189,605 | <p>I tried using <a href="http://stackoverflow.com/a/1235434/4794">Neil's answer</a>, but it doesn't work with a Tkinter GUI. For that, I had to <a href="http://stackoverflow.com/a/4771200/4794">override <code>report_callback_exception()</code></a>.</p>
<pre><code>import Tkinter as tk
import tkMessageBox
import traceb... | 0 | 2015-08-24T18:51:55Z | [
"python",
"exception"
] |
In GTK, how do I make a window unable to be closed? | 1,235,417 | <p>For example, graying out the "X" on windows systems.</p>
| 4 | 2009-08-05T19:59:22Z | 1,235,424 | <p>Just call the <code>set_deletable</code> with <code>False</code> on the window in question. It will work as long as GTK can convince the window manager to make the window unclosable. </p>
| 3 | 2009-08-05T20:00:25Z | [
"python",
"windows",
"gtk",
"pygtk"
] |
In GTK, how do I make a window unable to be closed? | 1,235,417 | <p>For example, graying out the "X" on windows systems.</p>
| 4 | 2009-08-05T19:59:22Z | 1,283,500 | <p>If Gtk can't convince the window manager you can always connect the "delete-event" signal and return True from the callback. Doing this Gtk assumes that the callback handle that signal and does nothing.</p>
<pre><code>import gtk
window = gtk.Window()
window.connect('delete-event',lambda widget, event: True)
</code... | 5 | 2009-08-16T05:19:23Z | [
"python",
"windows",
"gtk",
"pygtk"
] |
Searching a Unicode file using Python | 1,235,588 | <h1>Setup</h1>
<p>I'm writing a script to process and annotate build logs from Visual Studio. The build logs are HTML, and from what I can tell, Unicode (UTF-16?) as well. Here's a snippet from one of the files:</p>
<blockquote>
<p>c:\anonyfolder\anonyfile.c(17169) : warning C4701: potentially uninitialized local... | 1 | 2009-08-05T20:35:59Z | 1,235,625 | <p>Try using the codecs package:</p>
<pre><code>import codecs
buildLog = codecs.open(sys.argv[1], "r", "utf-16").readlines()
</code></pre>
<p>Also you may run into trouble with your print statement as it may try to convert the strings to your console encoding. If you're printing for your review you could use,</p>
<p... | 7 | 2009-08-05T20:42:51Z | [
"python",
"unicode",
"encoding"
] |
Searching a Unicode file using Python | 1,235,588 | <h1>Setup</h1>
<p>I'm writing a script to process and annotate build logs from Visual Studio. The build logs are HTML, and from what I can tell, Unicode (UTF-16?) as well. Here's a snippet from one of the files:</p>
<blockquote>
<p>c:\anonyfolder\anonyfile.c(17169) : warning C4701: potentially uninitialized local... | 1 | 2009-08-05T20:35:59Z | 1,235,698 | <p>Tried this? When saving a parsing script with non-ascii characters, I had the interpreter suggest an alternate encoding to the front of the file.</p>
<pre><code>Non-ASCII found, yet no encoding declared. Add a line like:
# -*- coding: cp1252 -*-
</code></pre>
<p>Adding that as the first line of the script fixed ... | 0 | 2009-08-05T20:55:11Z | [
"python",
"unicode",
"encoding"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,235,620 | <p>A RDBMS.</p>
<p>Nothing is more realiable than using tables on a well known RDBMS. <a href="http://www.postgresql.org/" rel="nofollow">Postgresql</a> comes to mind.</p>
<p>That automatically gives you some choices for the future like clustering. Also you automatically have a lot of tools to administer your databas... | 8 | 2009-08-05T20:41:50Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,235,683 | <p>Sqlite -- it comes with python, fast, widely availible and easy to maintain</p>
| 3 | 2009-08-05T20:52:11Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,235,761 | <p>If you only need simple (dict like) access mechanisms and need efficiency for processing a lot of data, then <a href="http://h5py.alfven.org/" rel="nofollow">HDF5</a> might be a good option. If you are going to be using numpy then it is really worth considering.</p>
| 2 | 2009-08-05T21:06:54Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,235,922 | <p>Go with a RDBMS is reliable scalable and fast.</p>
<p>If you need a more scalabre solution and don't need the features of RDBMS, you can go with a key-value store like couchdb that has a good python api.</p>
| 1 | 2009-08-05T21:43:36Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,235,947 | <p>Might want to give <a href="http://www.mongodb.org/">mongodb</a> a shot - the PyMongo library works with dictionaries and supports most Python types. Easy to install, very performant + scalable. MongoDB (and PyMongo) is also used <a href="http://www.mongodb.org/display/DOCS/Production+Deployments">in production</a> ... | 13 | 2009-08-05T21:49:31Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,237,699 | <p>I'm working on such a project and I'm using <a href="http://www.sqlite.org">SQLite</a>.</p>
<p>SQLite stores everything in one file and is part of <a href="http://docs.python.org/library/sqlite3.html">Python's standard library</a>. Hence, installation and configuration is virtually for free (ease of installation).<... | 5 | 2009-08-06T08:48:28Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,237,760 | <p>The NEMO collaboration (building a cosmic neutrino detector underwater) had much of the same problems, and they used mysql and postgresql without major problems.</p>
| 1 | 2009-08-06T09:03:37Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,247,644 | <p>if you really just need dictionary-like storage, some of the new key/value or column stores like Cassandra or MongoDB might provide a lot more speed than you'd get with a relational database. Of course if you decide to go with RDBMS, SQLAlchemy is the way to go (disclaimer: I am its creator), but your desired feat... | 4 | 2009-08-08T00:56:55Z | [
"python",
"orm",
"persistence"
] |
Comparing persistent storage solutions in python | 1,235,594 | <p>I'm starting on a new scientific project which has a lot of data (millions of entries) I'd like to store in an easily and quickly accessible format. I've come across a number of different potential options, but I'm not sure how to pick amongst them. My data can probably just be stored as a dictionary, or potentially... | 10 | 2009-08-05T20:37:18Z | 1,249,880 | <p>It really depends on what you're trying to do. An RDBMS is designed for <em>relational data</em>, so if your data is relational, then use one of the various SQL options. But it sounds like your data is more oriented towards a key-value store with very fast random GET operations. If that's the case, compare the bench... | 1 | 2009-08-08T20:57:18Z | [
"python",
"orm",
"persistence"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,628 | <p>list.pop() is a good choice:</p>
<pre><code>>>> a = [{'id': 1, 'name': 'paul'},
... {'id': 2, 'name': 'john'}]
>>> a.pop(1)
{'id': 2, 'name': 'john'}
>>> a
[{'id': 1, 'name': 'paul'}]
</code></pre>
<p>You can develop other ways of tracking done <em>which</em> dictionary you want to elimi... | 1 | 2009-08-05T20:43:04Z | [
"python",
"list",
"dictionary"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,631 | <pre><code>thelist[:] = [d for d in thelist if d.get('id') != 2]
</code></pre>
<p><strong>Edit</strong>: as some doubts have been expressed in a comment about the performance of this code (some based on misunderstanding Python's performance characteristics, some on assuming beyond the given specs that there is exactly... | 40 | 2009-08-05T20:43:26Z | [
"python",
"list",
"dictionary"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,647 | <p>You can try the following: </p>
<pre><code>a = [{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
for e in range(len(a) - 1, -1, -1):
if a[e]['id'] == 2:
a.pop(e)
</code></pre>
<p>If You can't pop from the beginning - pop from the end, it won't ruin the for loop.</p>
| 0 | 2009-08-05T20:46:13Z | [
"python",
"list",
"dictionary"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,655 | <p>Here's a way to do it with a list comprehension (assuming you name your list 'foo'):</p>
<pre><code>[x for x in foo if not (2 == x.get('id'))]
</code></pre>
<p>Substitute <code>'john' == x.get('name')</code> or whatever as appropriate.</p>
<p><code>filter</code> also works:</p>
<p><code>foo.filter(lambda x: x.ge... | 3 | 2009-08-05T20:46:48Z | [
"python",
"list",
"dictionary"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,677 | <p>You could try something along the following lines:</p>
<pre><code>def destructively_remove_if(predicate, list):
for k in xrange(len(list)):
if predicate(list[k]):
del list[k]
break
return list
list = [
{ 'id': 1, 'name': 'John' },
{ 'id': 2, 'name': '... | 0 | 2009-08-05T20:51:38Z | [
"python",
"list",
"dictionary"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,684 | <p>This is not properly an anwser (as I think you already have some quite good of them), but... have you considered of having a dictionary of <code><id>:<name></code> instead of a list of dictionaries?</p>
| 4 | 2009-08-05T20:52:17Z | [
"python",
"list",
"dictionary"
] |
Python: remove dictionary from list | 1,235,618 | <p>If I have a list of dictionaries, say:</p>
<pre><code>[{'id': 1, 'name': 'paul'},
{'id': 2, 'name': 'john'}]
</code></pre>
<p>and I would like to remove the dictionary with <code>id</code> of 2 (or name john), what is the most efficient way to go about this programmatically (that is to say, I don't know the index ... | 19 | 2009-08-05T20:41:13Z | 1,235,710 | <pre><code># assume ls contains your list
for i in range(len(ls)):
if ls[i]['id'] == 2:
del ls[i]
break
</code></pre>
<p>Will probably be faster than the list comprehension methods on average because it doesn't traverse the whole list if it finds the item in question early on.</p>
| 0 | 2009-08-05T20:58:06Z | [
"python",
"list",
"dictionary"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 1,235,671 | <p>No, you can't.</p>
<p>Modern browsers only run javascript or plugins. You can develop your own python plugin and convince people to download and run it, but I guess that falls to the "not inside the browser" category.</p>
| 3 | 2009-08-05T20:50:02Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 1,235,672 | <p>You mean client-side?</p>
<p><a href="http://books.google.com/books?id=fzUCGtyg0MMC&pg=PA437&lpg=PA437&dq=python+client+side+script+internet+explorer&source=bl&ots=Y221r-y9yw&sig=GZtEidkb3N5KypJBvyaBOKOvsHE&hl=en&ei=pvB5SpSqH5-Ntgfag92WCQ&sa=X&oi=book%5Fresult&ct=result&a... | 3 | 2009-08-05T20:50:08Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 1,235,689 | <p>By accident I was listening to <a href="http://www.hanselminutes.com/default.aspx?ShowID=191" rel="nofollow"> Hanselminutes </a> where he mentioned about Gestalt project. This is a solution to integrate a languages as IronRuby and IronPython in browser via Silverlight.</p>
<p>So I think the answer is no if you don'... | 2 | 2009-08-05T20:53:28Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 1,235,778 | <p>The <a href="http://pyjs.org/">Pyjamas</a> project has a compiler called pyjs which turns Python code into Javascript.</p>
| 9 | 2009-08-05T21:10:38Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 3,009,499 | <p>nosklo's answer is wrong: pyxpcomext for firefox adds language="python" support to script tags. yes it's a whopping 10mb plugin, but that's life. i think it's best if you refer to <a href="http://wiki.python.org/moin/WebBrowserProgramming">http://wiki.python.org/moin/WebBrowserProgramming</a> because that is where... | 6 | 2010-06-09T20:07:20Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 10,701,304 | <p><a href="http://repl.it/" rel="nofollow">http://repl.it/</a> - Python interpreter in JavaScript running on client side. There are many other languages too. Source is available under MIT license, which is awesome.</p>
| 3 | 2012-05-22T11:40:13Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 15,921,657 | <p>On my travels, I came across <a href="http://www.skulpt.org/" rel="nofollow">Skulpt</a>, a project which seems to offer Python directly in the browser without plugins. It's licensed under MIT.</p>
<p><a href="http://www.skulpt.org/" rel="nofollow">Skulpt Homepage</a></p>
<p><a href="https://github.com/bnmnetp/skul... | 4 | 2013-04-10T09:14:05Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 17,888,934 | <p>I put together a table comparing many Python-In-Browser technologies not long ago:
<a href="http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html">http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html</a></p>
| 5 | 2013-07-26T18:56:09Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 20,455,523 | <p>Brython - "A Python 3 implementation for client-side web programming"</p>
<ul>
<li><a href="http://www.brython.info/" rel="nofollow">http://www.brython.info/</a></li>
<li><a href="https://bitbucket.org/olemis/brython/src" rel="nofollow">https://bitbucket.org/olemis/brython/src</a></li>
</ul>
| 2 | 2013-12-08T16:08:01Z | [
"python",
"browser",
"remote-execution"
] |
Execute python code inside browser without Jython | 1,235,629 | <p>Is there a way to execute python code in a browser, other than using Jython and an applet?</p>
<p>The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.</p>
<p>I am aware... | 17 | 2009-08-05T20:43:04Z | 39,829,630 | <p>You can now (2016) also use:</p>
<p><a href="http://www.transcrypt.org" rel="nofollow">http://www.transcrypt.org</a></p>
<p>It compiles a large subset of Python 3.5 (incl. multiple inheritance, operator overloading, all types of comprehensions, generators & iterators) to lean and fast JS, supports source level... | 0 | 2016-10-03T10:37:17Z | [
"python",
"browser",
"remote-execution"
] |
new django app's from 1.1 causing 500 error | 1,235,777 | <p>i'm running on wsgi on centos 5... </p>
<p>i've recently updated locally from 1.0 to 1.1</p>
<p>I updated the server using svn update </p>
<p>now when I apply a new app developed locally to the server it returns with a 500 error.</p>
<p>all i'm doing is python manage.py startapp appname</p>
<p>adding the app in... | 0 | 2009-08-05T21:10:37Z | 1,248,150 | <p>Check also the list at <a href="http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges" rel="nofollow">http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges</a>.</p>
| 1 | 2009-08-08T06:34:40Z | [
"python",
"django",
"centos"
] |
new django app's from 1.1 causing 500 error | 1,235,777 | <p>i'm running on wsgi on centos 5... </p>
<p>i've recently updated locally from 1.0 to 1.1</p>
<p>I updated the server using svn update </p>
<p>now when I apply a new app developed locally to the server it returns with a 500 error.</p>
<p>all i'm doing is python manage.py startapp appname</p>
<p>adding the app in... | 0 | 2009-08-05T21:10:37Z | 1,252,372 | <p>Didn't we solve this for you in IRC the other day? If not, there was someone with the same OS and vague problem description.</p>
<p>Turned out to be a third-party app causing the problem, not the newly added one (which a review of the trackback proved if read carefully)</p>
| 1 | 2009-08-09T21:44:30Z | [
"python",
"django",
"centos"
] |
Using localflavor Django form fields on Google's App Engine | 1,235,851 | <p>Is it possible to use the form fields from </p>
<pre><code>django.contrib.localflavor.us.forms
</code></pre>
<p>on the Google App Engine? Can I simply use those form fields, or do I need a form field under </p>
<pre><code>google.appengine.ext.db.djangoforms
</code></pre>
| 1 | 2009-08-05T21:26:49Z | 5,959,177 | <p>You would need to grab the folder under <code>django.contrib.localflavour</code> and import it into your app.</p>
| 1 | 2011-05-11T04:16:00Z | [
"python",
"django",
"google-app-engine",
"django-forms"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.