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 |
|---|---|---|---|---|---|---|---|---|---|
PYTHON: Update MULTIPLE COLUMNS with python variables | 1,081,750 | <p>I'm trying to write a valid mysql statement that would allow me to update multiple columns in one record with values provided as python variables.</p>
<p>My statement would look like this:</p>
<pre><code>db = MySQLdb.connect(host="localhost", user="user", passwd="password", db="dbname")
cursor = db.cursor()
sql_up... | 0 | 2009-07-04T07:42:43Z | 1,081,794 | <p>Maybe it's about apostrophes around string/VARCHAR values:</p>
<pre><code>sql_update = "UPDATE table_name SET field1='%s', field2='%s', field3='%s', field4='%s', field5='%s', field6='%s', field7='%s', field8='%s', field9='%s', field10='%s' WHERE id='%s'" % (var1, var2, var3, var4, var5, var6, var7, var8, var9, var1... | 0 | 2009-07-04T08:23:55Z | [
"python",
"mysql",
"variables"
] |
PYTHON: Update MULTIPLE COLUMNS with python variables | 1,081,750 | <p>I'm trying to write a valid mysql statement that would allow me to update multiple columns in one record with values provided as python variables.</p>
<p>My statement would look like this:</p>
<pre><code>db = MySQLdb.connect(host="localhost", user="user", passwd="password", db="dbname")
cursor = db.cursor()
sql_up... | 0 | 2009-07-04T07:42:43Z | 35,963,084 | <p>I did it as:</p>
<pre><code> def bscaSoporte(self, denom_sop):
soporte = (denom_sop,) #Para que tome la variable, lista
sql= 'SELECT * FROM SOPORTE_ID WHERE denom_sop LIKE ?'
self.cursor1.execute(sql, soporte)
return self.cursor1.fetchall()
def updSoporte(self, lstNuevosVal):... | 0 | 2016-03-12T20:44:47Z | [
"python",
"mysql",
"variables"
] |
Yahoo Chat in Python | 1,082,078 | <p>I'm wondering how the best way to build a way to interface with Yahoo Chat is. I haven't found anything that looks incredibly easy to do yet. One thought it to build it all from scratch, the other thought would be to grab the code from open source software. I could use something like zinc, however, this maybe mor... | 1 | 2009-07-04T12:03:15Z | 1,082,094 | <p><a href="https://github.com/fahhem/python-purple" rel="nofollow">Python-purple</a> is a python API for accessing libpurple, the Pidgin backend. It will give you access to all the IM networks which Pidgin supports, including Y!Messenger, MSN Messenger, Jabber/GTalk/XMPP, and more...</p>
| 4 | 2009-07-04T12:12:11Z | [
"python",
"networking"
] |
2D vector projection in Python | 1,082,187 | <p>The code below projects the blue vector, AC, onto the red vector, AB, the resulting projected vector, AD, is drawn as purple. This is intended as my own implementation of <a href="http://demonstrations.wolfram.com/VectorProjections/" rel="nofollow">this Wolfram demonstration</a>.</p>
<p>Something is wrong however a... | 2 | 2009-07-04T13:13:45Z | 1,082,203 | <p>Shouldn't this</p>
<pre><code>D = project(AC,AB)
AD = vsub(D,A)
</code></pre>
<p>be</p>
<pre><code>AD = project(AC,AB)
D = vadd(A,AD)
</code></pre>
<p>Unfortunately, I can't test it, but that's the only thing that looks wrong to me.</p>
| 6 | 2009-07-04T13:24:12Z | [
"python",
"math",
"2d",
"projection"
] |
Automatically pressing a "submit" button using python | 1,082,361 | <p>The bus company I use runs an awful website (<a href="http://mslworld.egged.co.il/eggedtimetable/WebForms/wfrmMain.aspx?width=1024&company=1&language=he&state=" rel="nofollow">Hebrew</a>,<a href="http://mslworld.egged.co.il/eggedtimetable/WebForms/wfrmMain.aspx?width=1024&company=1&language=en&am... | 1 | 2009-07-04T15:00:38Z | 1,082,380 | <p><a href="http://twill.idyll.org/">Twill</a> is a simple scripting language for Web browsing. It happens to sport a <a href="http://twill.idyll.org/python-api.html">python api</a>.</p>
<blockquote>
<p>twill is essentially a thin shell around the mechanize package. All twill commands are implemented in the commands... | 10 | 2009-07-04T15:14:08Z | [
"python",
"scripting",
"form-submit",
"data-harvest"
] |
Automatically pressing a "submit" button using python | 1,082,361 | <p>The bus company I use runs an awful website (<a href="http://mslworld.egged.co.il/eggedtimetable/WebForms/wfrmMain.aspx?width=1024&company=1&language=he&state=" rel="nofollow">Hebrew</a>,<a href="http://mslworld.egged.co.il/eggedtimetable/WebForms/wfrmMain.aspx?width=1024&company=1&language=en&am... | 1 | 2009-07-04T15:00:38Z | 1,082,396 | <p>I would suggest you use <a href="http://wwwsearch.sourceforge.net/mechanize/">mechanize</a>. Here's a code snippet from their page that shows how to submit a form :</p>
<pre><code>
import re
from mechanize import Browser
br = Browser()
br.open("http://www.example.com/")
# follow second link with element text match... | 10 | 2009-07-04T15:22:14Z | [
"python",
"scripting",
"form-submit",
"data-harvest"
] |
Automatically pressing a "submit" button using python | 1,082,361 | <p>The bus company I use runs an awful website (<a href="http://mslworld.egged.co.il/eggedtimetable/WebForms/wfrmMain.aspx?width=1024&company=1&language=he&state=" rel="nofollow">Hebrew</a>,<a href="http://mslworld.egged.co.il/eggedtimetable/WebForms/wfrmMain.aspx?width=1024&company=1&language=en&am... | 1 | 2009-07-04T15:00:38Z | 1,082,412 | <p>You very rarely want to actually "press the submit button", rather than making GET or POST requests to the handler resource directly. Look at the HTML where the form is, and see what parameters its submitting to what URL, and if it is GET or POST method. You can form these requests with urllib(2) easily enough.</p>
| 7 | 2009-07-04T15:30:05Z | [
"python",
"scripting",
"form-submit",
"data-harvest"
] |
Sort a list of strings based on regular expression match or something similar | 1,082,413 | <p>I have a text file that looks a bit like:</p>
<pre><code>random text random text, can be anything blabla %A blabla
random text random text, can be anything blabla %D blabla
random text random text, can be anything blabla blabla %F
random text random text, can be anything blabla blabla
random text random text, %C ca... | 4 | 2009-07-04T15:30:10Z | 1,082,431 | <pre><code>In [1]: def grp(pat, txt):
...: r = re.search(pat, txt)
...: return r.group(0) if r else '&'
In [2]: y
Out[2]:
['random text random text, can be anything blabla %A blabla',
'random text random text, can be anything blabla %D blabla',
'random text random text, can be anything blabla bla... | 5 | 2009-07-04T15:38:59Z | [
"python",
"sorting"
] |
Sort a list of strings based on regular expression match or something similar | 1,082,413 | <p>I have a text file that looks a bit like:</p>
<pre><code>random text random text, can be anything blabla %A blabla
random text random text, can be anything blabla %D blabla
random text random text, can be anything blabla blabla %F
random text random text, can be anything blabla blabla
random text random text, %C ca... | 4 | 2009-07-04T15:30:10Z | 1,082,434 | <p>You could use a custom <code>key</code> function to compare the strings. Using the <code>lambda</code> syntax you can write that inline, like so:</p>
<pre><code>strings.sort(key=lambda str: re.sub(".*%", "", str));
</code></pre>
<p>The <code>re.sub(".*%", "", str)</code> call effectively removes anything before th... | 1 | 2009-07-04T15:40:10Z | [
"python",
"sorting"
] |
Sort a list of strings based on regular expression match or something similar | 1,082,413 | <p>I have a text file that looks a bit like:</p>
<pre><code>random text random text, can be anything blabla %A blabla
random text random text, can be anything blabla %D blabla
random text random text, can be anything blabla blabla %F
random text random text, can be anything blabla blabla
random text random text, %C ca... | 4 | 2009-07-04T15:30:10Z | 1,082,435 | <p>what about this? hope this helps.</p>
<pre><code>def k(line):
v = line.partition("%")[2]
v = v[0] if v else 'z' # here z stands for the max value
return v
print ''.join(sorted(open('data.txt', 'rb'), key = k))
</code></pre>
| 3 | 2009-07-04T15:40:29Z | [
"python",
"sorting"
] |
Sort a list of strings based on regular expression match or something similar | 1,082,413 | <p>I have a text file that looks a bit like:</p>
<pre><code>random text random text, can be anything blabla %A blabla
random text random text, can be anything blabla %D blabla
random text random text, can be anything blabla blabla %F
random text random text, can be anything blabla blabla
random text random text, %C ca... | 4 | 2009-07-04T15:30:10Z | 1,082,447 | <p>Here is a quick-and-dirty approach. Without knowing more about the requirements of your sort, I can't know if this satisfies your need. </p>
<p>Assume that your list is held in '<code>listoflines</code>':</p>
<pre><code>listoflines.sort( key=lambda x: x[x.find('%'):] )
</code></pre>
<p>Note that this will sort al... | 1 | 2009-07-04T15:45:16Z | [
"python",
"sorting"
] |
Running both python 2.6 and 3.1 on the same machine | 1,082,692 | <p>I'm currently toying with python at home and I'm planning to switch to python 3.1. The fact is that I have some script that use python 2.6 and I can't convert them since they use some module that aren't available for python 3.1 atm. So I'm considering installing python 3.1 along my python 2.6. I only found people on... | 1 | 2009-07-04T18:02:49Z | 1,082,698 | <p>You're not supposed to need to run them together.</p>
<p>2.6 already has all of the 3.0 features. You can enable those features with <code>from __future__ import</code> statements.</p>
<p>It's much simpler run 2.6 (with some <code>from __future__ import</code>) until everything you need is in 3.x, then switch.</p... | 1 | 2009-07-04T18:08:12Z | [
"python",
"linux",
"python-3.x"
] |
Running both python 2.6 and 3.1 on the same machine | 1,082,692 | <p>I'm currently toying with python at home and I'm planning to switch to python 3.1. The fact is that I have some script that use python 2.6 and I can't convert them since they use some module that aren't available for python 3.1 atm. So I'm considering installing python 3.1 along my python 2.6. I only found people on... | 1 | 2009-07-04T18:02:49Z | 1,082,730 | <p>Download the python version you want to have as an alternative, untar it, and when you configure it, use --prefix=/my/alt/dir</p>
<p>Cheers</p>
<pre><code>Nik
</code></pre>
| 2 | 2009-07-04T18:21:09Z | [
"python",
"linux",
"python-3.x"
] |
Running both python 2.6 and 3.1 on the same machine | 1,082,692 | <p>I'm currently toying with python at home and I'm planning to switch to python 3.1. The fact is that I have some script that use python 2.6 and I can't convert them since they use some module that aren't available for python 3.1 atm. So I'm considering installing python 3.1 along my python 2.6. I only found people on... | 1 | 2009-07-04T18:02:49Z | 1,103,293 | <p>On my Linux system (Ubuntu Jaunty), I have Python 2.5, 2.6 and 3.0 installed, just by installing the binary (deb) packages <strong>'python2.5'</strong>, <strong>'python2.6'</strong> and <strong>'python3.0'</strong> using apt-get. Perhaps Fedora packages them and names them as RPMs in a similar way.</p>
<p>I can run... | 3 | 2009-07-09T11:29:16Z | [
"python",
"linux",
"python-3.x"
] |
Running both python 2.6 and 3.1 on the same machine | 1,082,692 | <p>I'm currently toying with python at home and I'm planning to switch to python 3.1. The fact is that I have some script that use python 2.6 and I can't convert them since they use some module that aren't available for python 3.1 atm. So I'm considering installing python 3.1 along my python 2.6. I only found people on... | 1 | 2009-07-04T18:02:49Z | 1,103,562 | <p>Why do you need to use <code>make install</code> at all? After having done <code>make</code> to compile python 3.x, just move the python folder somewhere, and create a symlink to the python executable in your <code>~/bin</code> directory. Add that directory to your path if it isn't already, and you'll have a working... | 0 | 2009-07-09T12:33:52Z | [
"python",
"linux",
"python-3.x"
] |
How do you subclass the file type in Python? | 1,082,801 | <p>I'm trying to subclass the built-in <code>file</code> class in Python to add some extra features to <code>stdin</code> and <code>stdout</code>. Here's the code I have so far:</p>
<pre><code>class TeeWithTimestamp(file):
"""
Class used to tee the output of a stream (such as stdout or stderr) into
anothe... | 13 | 2009-07-04T19:07:22Z | 1,082,817 | <p>Calling <code>file.__init__</code> is quite feasible (e.g., on '/dev/null') but no real use because your attempted override of <code>write</code> doesn't "take" for the purposes of <code>print</code> statements -- the latter internally calls the real <code>file.write</code> when it sees that <code>sys.stdout</code> ... | 12 | 2009-07-04T19:17:03Z | [
"python",
"file",
"subclass"
] |
How do you subclass the file type in Python? | 1,082,801 | <p>I'm trying to subclass the built-in <code>file</code> class in Python to add some extra features to <code>stdin</code> and <code>stdout</code>. Here's the code I have so far:</p>
<pre><code>class TeeWithTimestamp(file):
"""
Class used to tee the output of a stream (such as stdout or stderr) into
anothe... | 13 | 2009-07-04T19:07:22Z | 2,484,093 | <p>You can as well avoid using <code>super</code> :</p>
<pre><code>class SuperFile(file):
def __init__(self, *args, **kwargs):
file.__init__(self, *args, **kwargs)
</code></pre>
<p>You'll be able to write with it.</p>
| 2 | 2010-03-20T17:55:21Z | [
"python",
"file",
"subclass"
] |
Apache: VirtualHost with [PHP|Python|Ruby] support | 1,082,906 | <p>I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way <strong>to optimize</strong> my Apache Server to load
<strong>certain</strong> modules <strong>only</strong> in <strong>certain</strong> VirtualHost, for instance: </p>
<pre><code>http://myapp1 <- just with R... | 1 | 2009-07-04T20:17:33Z | 1,082,924 | <p>I dont think thats possible as,</p>
<ol>
<li>The same thread/forked process might be serving pages from different Virtualhosts. So if it has loaded only python, what happens when it needs to serve ruby?</li>
<li>For reason 1, certain directives are web server only, and not virtualhost specific. MaxRequestsPerChild,... | 0 | 2009-07-04T20:27:21Z | [
"php",
"python",
"ruby",
"apache",
"virtualhost"
] |
Apache: VirtualHost with [PHP|Python|Ruby] support | 1,082,906 | <p>I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way <strong>to optimize</strong> my Apache Server to load
<strong>certain</strong> modules <strong>only</strong> in <strong>certain</strong> VirtualHost, for instance: </p>
<pre><code>http://myapp1 <- just with R... | 1 | 2009-07-04T20:17:33Z | 1,082,975 | <p>Each Apache worker loads every module, so it's not possible to do within Apache itself.</p>
<p>What you need to do is move your language modules to processes external to Apache workers.</p>
<p>This is done for your languages with the following modules:</p>
<ul>
<li><strong>PHP</strong>: <a href="http://www.fastcg... | 3 | 2009-07-04T21:12:49Z | [
"php",
"python",
"ruby",
"apache",
"virtualhost"
] |
Apache: VirtualHost with [PHP|Python|Ruby] support | 1,082,906 | <p>I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way <strong>to optimize</strong> my Apache Server to load
<strong>certain</strong> modules <strong>only</strong> in <strong>certain</strong> VirtualHost, for instance: </p>
<pre><code>http://myapp1 <- just with R... | 1 | 2009-07-04T20:17:33Z | 1,136,664 | <p>I think the only way is to have a "proxy" web server that dispatches requests to the real servers ...</p>
<p>The proxy server has a list of domain names -> Server Side language, and does nothing else but transparently redirecting to the correct real server</p>
<p>There are N real server, each one with a specific c... | 0 | 2009-07-16T10:18:36Z | [
"php",
"python",
"ruby",
"apache",
"virtualhost"
] |
Apache: VirtualHost with [PHP|Python|Ruby] support | 1,082,906 | <p>I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way <strong>to optimize</strong> my Apache Server to load
<strong>certain</strong> modules <strong>only</strong> in <strong>certain</strong> VirtualHost, for instance: </p>
<pre><code>http://myapp1 <- just with R... | 1 | 2009-07-04T20:17:33Z | 1,448,734 | <p>My Idea is several apache processes (each one with different config) listening on different addresses and/or ports and a http proxy (squid or apache) in the front redirecting to respective server. This has a possible added advantage of caching.</p>
| 0 | 2009-09-19T15:10:38Z | [
"php",
"python",
"ruby",
"apache",
"virtualhost"
] |
Want to write an eBook collection manager in Python. What do I need to learn? | 1,083,071 | <p>I have been teaching myself the rudiments of Python and have reached a stage where I would like to tackle a project of increasing complexity in order to "scratch an itch".</p>
<p>I have a large eBook collection (several gigabytes, organized in folders according to topic, mostly .pdf files with the occasional .djvu,... | 7 | 2009-07-04T22:18:13Z | 1,083,082 | <p>for your 'basic' needs no additional library is needed. the plain standard python library is sufficient. for your optional needs I was looking for answers too</p>
| 0 | 2009-07-04T22:29:25Z | [
"python"
] |
Want to write an eBook collection manager in Python. What do I need to learn? | 1,083,071 | <p>I have been teaching myself the rudiments of Python and have reached a stage where I would like to tackle a project of increasing complexity in order to "scratch an itch".</p>
<p>I have a large eBook collection (several gigabytes, organized in folders according to topic, mostly .pdf files with the occasional .djvu,... | 7 | 2009-07-04T22:18:13Z | 1,083,112 | <p>For the UI, I would suggest wxPython. Tkinter is more used, but I find it horrible. PyGTK and PyQt probably are good options too.
Here are two good tutorials:<br />
<a href="http://zetcode.com/wxpython/" rel="nofollow">http://zetcode.com/wxpython/</a><br />
<a href="http://wiki.wxpython.org/AnotherTutorial" rel="nof... | 3 | 2009-07-04T22:44:49Z | [
"python"
] |
Want to write an eBook collection manager in Python. What do I need to learn? | 1,083,071 | <p>I have been teaching myself the rudiments of Python and have reached a stage where I would like to tackle a project of increasing complexity in order to "scratch an itch".</p>
<p>I have a large eBook collection (several gigabytes, organized in folders according to topic, mostly .pdf files with the occasional .djvu,... | 7 | 2009-07-04T22:18:13Z | 1,083,140 | <p>Look at <a href="http://couchdb.apache.org" rel="nofollow">CouchDB</a> instead of traditional relational database models. It's document-centric, so it's a good fit for something like an e-book organizer. There are great python libs for it, but CouchDB speaks HTTP and JSON, so it's pretty trivial to query/connect, ... | 3 | 2009-07-04T23:03:31Z | [
"python"
] |
Want to write an eBook collection manager in Python. What do I need to learn? | 1,083,071 | <p>I have been teaching myself the rudiments of Python and have reached a stage where I would like to tackle a project of increasing complexity in order to "scratch an itch".</p>
<p>I have a large eBook collection (several gigabytes, organized in folders according to topic, mostly .pdf files with the occasional .djvu,... | 7 | 2009-07-04T22:18:13Z | 1,083,166 | <p>Firstly, I'm no pro; take everything I say with a pinch of salt.</p>
<p>The biggest decision I can see you're likely to need to take is the nature of the database.
I'd be tempted to state that the project is sufficiently ambitious that you might well want to look into something SQL-shaped for the database.</p>
<p... | 5 | 2009-07-04T23:23:55Z | [
"python"
] |
Want to write an eBook collection manager in Python. What do I need to learn? | 1,083,071 | <p>I have been teaching myself the rudiments of Python and have reached a stage where I would like to tackle a project of increasing complexity in order to "scratch an itch".</p>
<p>I have a large eBook collection (several gigabytes, organized in folders according to topic, mostly .pdf files with the occasional .djvu,... | 7 | 2009-07-04T22:18:13Z | 1,083,928 | <p><strong>"How would you go about tackling this project?"</strong></p>
<p>Slowly.</p>
<p>First, define your use cases. You have a list of features, but no user interaction even hinted at. Define what interactions you will make with your application and what value the application creates for you. This can be hard... | 3 | 2009-07-05T11:56:04Z | [
"python"
] |
Want to write an eBook collection manager in Python. What do I need to learn? | 1,083,071 | <p>I have been teaching myself the rudiments of Python and have reached a stage where I would like to tackle a project of increasing complexity in order to "scratch an itch".</p>
<p>I have a large eBook collection (several gigabytes, organized in folders according to topic, mostly .pdf files with the occasional .djvu,... | 7 | 2009-07-04T22:18:13Z | 10,569,373 | <p>Why would you write one if Calibre does that already. It's build based on a modular design and it allows Python based plugins . </p>
<p>Write a plugin instead to solve your specific need instead of reinventing the wheel :)</p>
| 0 | 2012-05-13T04:45:24Z | [
"python"
] |
Does creating separate functions instead of one big one slow processing time? | 1,083,105 | <p>I'm working in the Google App Engine environment and programming in Python. I am creating a function that essentially generates a random number/letter string and then stores to the memcache. </p>
<pre><code>def generate_random_string():
# return a random 6-digit long string
def check_and_store_to_memcache():
... | 7 | 2009-07-04T22:41:12Z | 1,083,121 | <p>Focus on being able to read and easily understand your code.</p>
<p>Once you've done this, if you have a performance problem, then look into what might be causing it.</p>
<p>Most languages, python included, tend to have fairly low overhead for making method calls. Putting this code into a single function is not g... | 27 | 2009-07-04T22:47:33Z | [
"python",
"google-app-engine",
"function",
"performance"
] |
Does creating separate functions instead of one big one slow processing time? | 1,083,105 | <p>I'm working in the Google App Engine environment and programming in Python. I am creating a function that essentially generates a random number/letter string and then stores to the memcache. </p>
<pre><code>def generate_random_string():
# return a random 6-digit long string
def check_and_store_to_memcache():
... | 7 | 2009-07-04T22:41:12Z | 1,085,124 | <p>Reed is right. For the change you're considering, the cost of a function call is a small number of cycles, and you'd have to be doing it 10^8 or so times per second before you'd notice.</p>
<p>However, I would caution that often people go to the other extreme, and then it is <em>as if</em> function calls were costl... | 4 | 2009-07-06T02:02:39Z | [
"python",
"google-app-engine",
"function",
"performance"
] |
Does creating separate functions instead of one big one slow processing time? | 1,083,105 | <p>I'm working in the Google App Engine environment and programming in Python. I am creating a function that essentially generates a random number/letter string and then stores to the memcache. </p>
<pre><code>def generate_random_string():
# return a random 6-digit long string
def check_and_store_to_memcache():
... | 7 | 2009-07-04T22:41:12Z | 1,085,128 | <p>In almost all cases, "inlining" functions to increase speed is like getting a hair cut to lose weight.</p>
| 13 | 2009-07-06T02:06:33Z | [
"python",
"google-app-engine",
"function",
"performance"
] |
Does creating separate functions instead of one big one slow processing time? | 1,083,105 | <p>I'm working in the Google App Engine environment and programming in Python. I am creating a function that essentially generates a random number/letter string and then stores to the memcache. </p>
<pre><code>def generate_random_string():
# return a random 6-digit long string
def check_and_store_to_memcache():
... | 7 | 2009-07-04T22:41:12Z | 1,085,147 | <p>Like others have said, I wouldn't worry about it in this particular scenario. The very small overhead involved in function calls would pale in comparison to what is done inside each function. And as long as these functions don't get called in rapid succession, it probably wouldn't matter much anyway.</p>
<p>It is... | 2 | 2009-07-06T02:19:24Z | [
"python",
"google-app-engine",
"function",
"performance"
] |
What is the Pythonic way to write this loop? | 1,083,115 | <pre><code>for jr in json_reports:
jr['time_created'] = str(jr['time_created'])
</code></pre>
| 1 | 2009-07-04T22:46:04Z | 1,083,128 | <p>Looks to me that you're already there</p>
| 10 | 2009-07-04T22:51:49Z | [
"python"
] |
What is the Pythonic way to write this loop? | 1,083,115 | <pre><code>for jr in json_reports:
jr['time_created'] = str(jr['time_created'])
</code></pre>
| 1 | 2009-07-04T22:46:04Z | 1,083,130 | <p>That would be the pythonic way to write the loop if you need to assign it to the same list.</p>
<p>If you just want to pull out strings of all <code>time_created</code> indices in each element of <code>json_reports</code>, you can use a list comprehension:</p>
<pre><code>strings = [str(i['time_created']) for i in ... | 5 | 2009-07-04T22:53:51Z | [
"python"
] |
Play mp3 using Python, PyQt, and Phonon | 1,083,118 | <p>I been trying all day to figure out the Qt's Phonon library with Python. </p>
<p>My long term goal is to see if I could get it to play a mms:// stream, but since I can't find an implementation of this done anywhere, I will figure that part out myself. (figured I'd put it out there if anyone knew more about this spe... | 7 | 2009-07-04T22:47:08Z | 1,116,179 | <p>Phonon supports different audio file formats on different platforms, using the system's own support for media formats, so it could be that your system doesn't provide libraries for playing MP3 files. Certainly, MP3 is not supported out of the box on some Linux distributions. If you are using Linux, please take a loo... | 2 | 2009-07-12T15:03:54Z | [
"python",
"pyqt",
"media",
"phonon"
] |
Play mp3 using Python, PyQt, and Phonon | 1,083,118 | <p>I been trying all day to figure out the Qt's Phonon library with Python. </p>
<p>My long term goal is to see if I could get it to play a mms:// stream, but since I can't find an implementation of this done anywhere, I will figure that part out myself. (figured I'd put it out there if anyone knew more about this spe... | 7 | 2009-07-04T22:47:08Z | 2,563,460 | <p>In <code>delayedInit</code> method; create <code>MediaObject</code> like following:</p>
<pre><code>def delayedInit(self):
if not self.m_media:
self.m_media = Phonon.createPlayer(Phonon.MusicCategory)
</code></pre>
| 1 | 2010-04-01T20:30:20Z | [
"python",
"pyqt",
"media",
"phonon"
] |
How would you adblock using Python? | 1,083,170 | <p>I'm slowly building a <a href="http://github.com/regomodo/qtBrowser/tree/master" rel="nofollow">web browser</a> in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser.</p>
<p>How would you go about it usin... | 4 | 2009-07-04T23:29:48Z | 1,085,037 | <p>Is this question about web filtering?</p>
<p>Then try use some of external web-proxy, for sample Privoxy (<a href="http://en.wikipedia.org/wiki/Privoxy" rel="nofollow">http://en.wikipedia.org/wiki/Privoxy</a>).</p>
| 0 | 2009-07-05T23:14:43Z | [
"python",
"pyqt4",
"adblock"
] |
How would you adblock using Python? | 1,083,170 | <p>I'm slowly building a <a href="http://github.com/regomodo/qtBrowser/tree/master" rel="nofollow">web browser</a> in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser.</p>
<p>How would you go about it usin... | 4 | 2009-07-04T23:29:48Z | 1,085,057 | <p>The easylist.txt file is simply plain text, as demonstrated here: <a href="http://adblockplus.mozdev.org/easylist/easylist.txt" rel="nofollow">http://adblockplus.mozdev.org/easylist/easylist.txt</a></p>
<p>lines beginning with [ and also ! appear to be comments, so it is simply a case of sorting through the file, a... | 0 | 2009-07-05T23:25:22Z | [
"python",
"pyqt4",
"adblock"
] |
How would you adblock using Python? | 1,083,170 | <p>I'm slowly building a <a href="http://github.com/regomodo/qtBrowser/tree/master" rel="nofollow">web browser</a> in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser.</p>
<p>How would you go about it usin... | 4 | 2009-07-04T23:29:48Z | 1,490,881 | <p>Privoxy is solid. If you want it to be completely API based though, check out the <a href="http://bcws.brightcloud.com" rel="nofollow">BrightCloud web filtering API</a> as well.</p>
| 0 | 2009-09-29T06:24:36Z | [
"python",
"pyqt4",
"adblock"
] |
How would you adblock using Python? | 1,083,170 | <p>I'm slowly building a <a href="http://github.com/regomodo/qtBrowser/tree/master" rel="nofollow">web browser</a> in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser.</p>
<p>How would you go about it usin... | 4 | 2009-07-04T23:29:48Z | 18,323,507 | <p>I know this is an old question, but I thought I'd try giving an answer for anyone who happens to stumble upon it. You could create a subclass of QNetworkAccessManager and combine it with <a href="https://github.com/atereshkin/abpy" rel="nofollow">https://github.com/atereshkin/abpy</a>. Something kind of like this:</... | 4 | 2013-08-19T21:33:28Z | [
"python",
"pyqt4",
"adblock"
] |
Running JSON through Python's eval()? | 1,083,250 | <p>Best practices aside, is there a compelling reason <strong>not</strong> to do this?</p>
<p>I'm writing a post-commit hook for use with a Google Code project, which provides commit data via a JSON object. GC provides an HMAC authentication token along with the request (outside the JSON data), so by validating that ... | 17 | 2009-07-05T00:35:10Z | 1,083,262 | <p>The point of best practices is that in most cases, it's a bad idea to disregard them. If I were you, I'd use a parser to parse JSON into Python. Try out <a href="http://undefined.org/python/#simplejson" rel="nofollow">simplejson</a>, it was very straightforward for parsing JSON when I last tried it and it claims to ... | 10 | 2009-07-05T00:40:58Z | [
"python",
"json"
] |
Running JSON through Python's eval()? | 1,083,250 | <p>Best practices aside, is there a compelling reason <strong>not</strong> to do this?</p>
<p>I'm writing a post-commit hook for use with a Google Code project, which provides commit data via a JSON object. GC provides an HMAC authentication token along with the request (outside the JSON data), so by validating that ... | 17 | 2009-07-05T00:35:10Z | 1,083,302 | <p>If you're comfortable with your script working fine for a while, and then randomly failing on some obscure edge case, I would go with eval.</p>
<p>If it's important that your code be robust, I would take the time to add simplejson. You don't need the C portion for speedups, so it really shouldn't be hard to dump a ... | 24 | 2009-07-05T01:28:43Z | [
"python",
"json"
] |
Running JSON through Python's eval()? | 1,083,250 | <p>Best practices aside, is there a compelling reason <strong>not</strong> to do this?</p>
<p>I'm writing a post-commit hook for use with a Google Code project, which provides commit data via a JSON object. GC provides an HMAC authentication token along with the request (outside the JSON data), so by validating that ... | 17 | 2009-07-05T00:35:10Z | 1,083,318 | <p><code>eval</code>ing JSON is a bit like trying to run XML through a C++ compiler. </p>
<p><code>eval</code> is meant to evaluate Python code. Although there are some syntactical similarities, <strong>JSON isn't Python code</strong>. Heck, not only is it not <em>Python</em> code, it's not code to begin with. The... | -2 | 2009-07-05T01:40:50Z | [
"python",
"json"
] |
Running JSON through Python's eval()? | 1,083,250 | <p>Best practices aside, is there a compelling reason <strong>not</strong> to do this?</p>
<p>I'm writing a post-commit hook for use with a Google Code project, which provides commit data via a JSON object. GC provides an HMAC authentication token along with the request (outside the JSON data), so by validating that ... | 17 | 2009-07-05T00:35:10Z | 28,351,359 | <p>One major difference is that a boolean in JSON is <code>true</code>|<code>false</code>, but Python uses <code>True</code>|<code>False</code>.</p>
<p>The most important reason not to do this can be generalized: <code>eval</code> should never be used to interpret external input since this allows for arbitrary code ex... | 0 | 2015-02-05T18:26:45Z | [
"python",
"json"
] |
Missing datetime.timedelta.to_seconds() -> float in Python? | 1,083,402 | <p>I understand that seconds and microseconds are probably represented separately in <code>datetime.timedelta</code> for efficiency reasons, but I just wrote this simple function:</p>
<pre><code>def to_seconds_float(timedelta):
"""Calculate floating point representation of combined
seconds/microseconds attribu... | 9 | 2009-07-05T03:28:02Z | 1,083,408 | <p>A Python float has about 15 significant digits, so with seconds being up to 86400 (5 digits to the left of the decimal point) and microseconds needing 6 digits, you could well include the days (up to several years' worth) without loss of precision.</p>
<p>A good mantra is "pi seconds is a nanocentury" -- about 3.14... | 12 | 2009-07-05T03:35:44Z | [
"python",
"datetime",
"timedelta"
] |
Missing datetime.timedelta.to_seconds() -> float in Python? | 1,083,402 | <p>I understand that seconds and microseconds are probably represented separately in <code>datetime.timedelta</code> for efficiency reasons, but I just wrote this simple function:</p>
<pre><code>def to_seconds_float(timedelta):
"""Calculate floating point representation of combined
seconds/microseconds attribu... | 9 | 2009-07-05T03:28:02Z | 1,083,613 | <p>Your concern for precision is misplaced. Here's a simple two-liner to calculate roughly how many YEARS you can squeeze into what's left of the 53 bits of precsion in an IEEE754 64-bit float:</p>
<pre><code>>>> import math
>>> 10 ** (math.log10(2 ** 53) - math.log10(60 * 60 * 24) - 6) / 365.25
285.... | 3 | 2009-07-05T07:17:38Z | [
"python",
"datetime",
"timedelta"
] |
Get brief human-readable info about XRI OpenID with Python? | 1,083,435 | <p>I'd like to be able to tell to the site visitor that comes with his/her OpenID: <strong>you are using your XYZ id for the first time on mysite - please create your sceen name</strong>, where XYZ is a nice token that makes sense. For example - XYZ could be the provider name.</p>
<p>I'd like to find a solution that w... | 0 | 2009-07-05T04:11:45Z | 1,083,594 | <p>Since OpenIDs are URLs, this might be the cleanest way in the absence of built-in support in Janrain:</p>
<pre><code>from urlparse import urlparse
openid_str = "http://myprovider/myname" # str(openid_obj)
parts = urlparse(openid_str)
provider_name = parts[1]
print (provider_name) # Prints myprovider
</code></pre>
| 3 | 2009-07-05T06:53:12Z | [
"python",
"openid",
"janrain",
"xri"
] |
How to handle back and forward buttons in the hildon.Seekbar? | 1,083,905 | <p>The <a href="http://maemo.org/development/documentation/apis/3-x/python-maemo-3.x/pyhildon%5Fseekbar/" rel="nofollow">hildon.Seekbar</a> widget consists of a scale widget and two buttons. What signals does the widget send when the buttons are clicked or how could I find out? Is there a way to monitor <strong>all</st... | 2 | 2009-07-05T11:40:35Z | 1,086,608 | <p>The documentation you linked to shows this:</p>
<pre><code>seekbar.connect("value-changed", control_changed, label)
seekbar.connect("notify::fraction", fraction_changed, label)
</code></pre>
<p>So it seems it has (at least) two signals called "value-changed" and "notify::fraction". It also shows an inheritance dia... | 1 | 2009-07-06T11:57:06Z | [
"python",
"gtk",
"pygtk",
"maemo",
"seekbar"
] |
How to handle back and forward buttons in the hildon.Seekbar? | 1,083,905 | <p>The <a href="http://maemo.org/development/documentation/apis/3-x/python-maemo-3.x/pyhildon%5Fseekbar/" rel="nofollow">hildon.Seekbar</a> widget consists of a scale widget and two buttons. What signals does the widget send when the buttons are clicked or how could I find out? Is there a way to monitor <strong>all</st... | 2 | 2009-07-05T11:40:35Z | 1,915,536 | <p>gobjects have a way of notifying about property changes and it does this with signals. So connecting to notify::property gets you changes to property.</p>
| 0 | 2009-12-16T15:51:16Z | [
"python",
"gtk",
"pygtk",
"maemo",
"seekbar"
] |
using registered com object dll from .NET | 1,083,913 | <p>I implemented a python com server and generate an executable and dll using py2exe tool.
then I used regsvr32.exe to register the dll.I got a message that the registration was successful. Then I tried to add reference to that dll in .NET. I browsed to the dll location and select it, but I got an error message box tha... | 2 | 2009-07-05T11:48:47Z | 1,083,993 | <p>If you want to use a registered <strong>Com</strong> object, you need to find it on the Com tab in the <a href="http://msdn.microsoft.com/en-us/library/wkze6zky.aspx" rel="nofollow">Add Reference</a> dialog box. You do not navigate to the dll.</p>
| 0 | 2009-07-05T12:38:44Z | [
".net",
"python",
"com",
"py2exe"
] |
using registered com object dll from .NET | 1,083,913 | <p>I implemented a python com server and generate an executable and dll using py2exe tool.
then I used regsvr32.exe to register the dll.I got a message that the registration was successful. Then I tried to add reference to that dll in .NET. I browsed to the dll location and select it, but I got an error message box tha... | 2 | 2009-07-05T11:48:47Z | 1,084,886 | <p>The line:</p>
<pre><code>_reg_clsid_ = pythoncom.CreateGuid()
</code></pre>
<p>creates a new GUID everytime this file is called. You can create a GUID on the command line:</p>
<pre><code>C:\>python -c "import pythoncom; print pythoncom.CreateGuid()"
{C86B66C2-408E-46EA-845E-71626F94D965}
</code></pre>
<p>and... | 2 | 2009-07-05T21:45:35Z | [
".net",
"python",
"com",
"py2exe"
] |
using registered com object dll from .NET | 1,083,913 | <p>I implemented a python com server and generate an executable and dll using py2exe tool.
then I used regsvr32.exe to register the dll.I got a message that the registration was successful. Then I tried to add reference to that dll in .NET. I browsed to the dll location and select it, but I got an error message box tha... | 2 | 2009-07-05T11:48:47Z | 1,152,106 | <p>I will answer my question to help any one may have similar questions. I hope that would help.
I can not find my server on the COM tab because, .NET (& Visual-Studio) need COM servers with TLB. But Python's COM servers have no TLB.
So to use the server from .NET by (C# and Late binding). The following code shows ... | 2 | 2009-07-20T07:25:19Z | [
".net",
"python",
"com",
"py2exe"
] |
Best way to programatically create image | 1,083,943 | <p>I'm looking for a way to create a graphics file (I don't really mind the file type, as they are easily converted).</p>
<p>The input would be the desired resolution, and a list of pixels and colors (x, y, RGB color).</p>
<p>Is there a convenient python library for that? What are the pros\cons\pitfalls?</p>
<p>Udi<... | 2 | 2009-07-05T12:03:30Z | 1,083,946 | <p><a href="http://www.pythonware.com/products/pil/">PIL</a> is the canonical Python Imaging Library.</p>
<p>Pros: Everybody wanting to do what you're doing uses PIL. 8-)</p>
<p>Cons: None springs to mind.</p>
| 5 | 2009-07-05T12:04:48Z | [
"python",
"graphics",
"python-imaging-library"
] |
Best way to programatically create image | 1,083,943 | <p>I'm looking for a way to create a graphics file (I don't really mind the file type, as they are easily converted).</p>
<p>The input would be the desired resolution, and a list of pixels and colors (x, y, RGB color).</p>
<p>Is there a convenient python library for that? What are the pros\cons\pitfalls?</p>
<p>Udi<... | 2 | 2009-07-05T12:03:30Z | 1,084,405 | <p>Alternatively, you can try <a href="http://www.imagemagick.org/script/api.php#python" rel="nofollow">ImageMagick</a>.
Last time I checked, PIL didn't work on Python 3, which is potentially a con. (I don't know about ImageMagick's API.) I believe an updated version of PIL is expected in the year.</p>
| 0 | 2009-07-05T16:41:22Z | [
"python",
"graphics",
"python-imaging-library"
] |
How to get an xpathContext from an xmlNode in python | 1,084,058 | <p>big fan of xpath on .net, and sax in python, but first time using xpath in python.</p>
<p>I have a small script, that uses xpath to select some nodes from a doc, iterates through them, and then ideally uses xpath again to get the relevant data from them. However I can't get that last bit, once I have the xmlNode I ... | 2 | 2009-07-05T13:27:21Z | 1,084,119 | <p>I don't think an XPathContext makes sense on an element? Try creating a new XPathContext, and setting it's node to the current element.</p>
<p>That said, I haven't used libxml2 directly, so it's a bit of a wild guess. I typically uses lxml, that exposes an ElementTree API around libxml2 and libxslt. It's much easie... | 2 | 2009-07-05T14:06:19Z | [
"python",
"xpath",
"xmlnode"
] |
How to get an xpathContext from an xmlNode in python | 1,084,058 | <p>big fan of xpath on .net, and sax in python, but first time using xpath in python.</p>
<p>I have a small script, that uses xpath to select some nodes from a doc, iterates through them, and then ideally uses xpath again to get the relevant data from them. However I can't get that last bit, once I have the xmlNode I ... | 2 | 2009-07-05T13:27:21Z | 32,629,090 | <p><a href="http://stackoverflow.com/a/3379708/288875">http://stackoverflow.com/a/3379708/288875</a> suggests to call <code>setContextNode(..)</code> on a newly created context:</p>
<pre><code>itemctxt = doc.xpathNewContext()
for item in listitems:
itemctxt.setContextNode(item)
title = itemctxt.xpathEval('.//... | 1 | 2015-09-17T11:20:23Z | [
"python",
"xpath",
"xmlnode"
] |
Make your program USE a gui | 1,084,514 | <p>I'd like to write a program able to "use" other programs by taking control of the mouse/keyboard and being able to "see" what's on the screen.</p>
<p>I used <a href="http://www.autoitscript.com/autoit3/" rel="nofollow">AutoIt</a> to do something similar, but I had to cheat sometimes because the language is not that... | 2 | 2009-07-05T17:52:25Z | 1,084,677 | <p>You can use <a href="http://www.tizmoi.net/watsup/intro.html" rel="nofollow">WATSUP</a> under Windows.</p>
| 2 | 2009-07-05T19:32:24Z | [
"python",
"user-interface",
"remote-control"
] |
Make your program USE a gui | 1,084,514 | <p>I'd like to write a program able to "use" other programs by taking control of the mouse/keyboard and being able to "see" what's on the screen.</p>
<p>I used <a href="http://www.autoitscript.com/autoit3/" rel="nofollow">AutoIt</a> to do something similar, but I had to cheat sometimes because the language is not that... | 2 | 2009-07-05T17:52:25Z | 1,084,773 | <p>I've used the Windows (only) <a href="http://msdn.microsoft.com/en-us/library/ms646310%28VS.85%29.aspx" rel="nofollow">Input API</a> to write a VNC-like remote-control application in the past. It lets you fake keyboard and mouse input nicely at a system level (ie not just posting events to a single application).</p... | 0 | 2009-07-05T20:34:32Z | [
"python",
"user-interface",
"remote-control"
] |
Make your program USE a gui | 1,084,514 | <p>I'd like to write a program able to "use" other programs by taking control of the mouse/keyboard and being able to "see" what's on the screen.</p>
<p>I used <a href="http://www.autoitscript.com/autoit3/" rel="nofollow">AutoIt</a> to do something similar, but I had to cheat sometimes because the language is not that... | 2 | 2009-07-05T17:52:25Z | 1,085,111 | <p>If you are comfortable with pascal, a really powerful keyboard/mouse/screen-reading program is SCAR: <a href="http://freddy1990.com/index.php?page=product&name=scar" rel="nofollow">http://freddy1990.com/index.php?page=product&name=scar</a> It can do OCR, bitmap finding, color finding, etc. It's often used ... | 1 | 2009-07-06T01:55:26Z | [
"python",
"user-interface",
"remote-control"
] |
Make your program USE a gui | 1,084,514 | <p>I'd like to write a program able to "use" other programs by taking control of the mouse/keyboard and being able to "see" what's on the screen.</p>
<p>I used <a href="http://www.autoitscript.com/autoit3/" rel="nofollow">AutoIt</a> to do something similar, but I had to cheat sometimes because the language is not that... | 2 | 2009-07-05T17:52:25Z | 1,085,936 | <p>I've had some luck with similar tasks using <a href="http://pywinauto.openqa.org/" rel="nofollow">PyWinAuto</a>.</p>
<blockquote>
<p>pywinauto is a set of python modules
to automate the Microsoft Windows GUI.
At it's simplest it allows you to send
mouse and keyboard actions to windows
dialogs and controls... | 2 | 2009-07-06T08:14:54Z | [
"python",
"user-interface",
"remote-control"
] |
Make your program USE a gui | 1,084,514 | <p>I'd like to write a program able to "use" other programs by taking control of the mouse/keyboard and being able to "see" what's on the screen.</p>
<p>I used <a href="http://www.autoitscript.com/autoit3/" rel="nofollow">AutoIt</a> to do something similar, but I had to cheat sometimes because the language is not that... | 2 | 2009-07-05T17:52:25Z | 1,092,401 | <p>AutoIt is completely capable of doing everything you mentioned. When I'm wanting to do some automation but use the features of Python, I find it easiest to use <a href="http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fwww.autoitscript.com%2Fautoit3%2Fdownloads.shtml&ei=Yk9T... | 2 | 2009-07-07T13:39:50Z | [
"python",
"user-interface",
"remote-control"
] |
Getting a dict out of a method? | 1,084,566 | <p>I'm trying to get a <code>dict</code> out of a method, so far I'm able to get the method name, and its arguments (using the inspect module), the problem I'm facing is that I'd like to have the default arguments too (or the argument type).</p>
<p>This is basically my unit test:</p>
<pre><code>class Test:
def me... | 1 | 2009-07-05T18:17:23Z | 1,084,599 | <p>what exactly is the problem? all arguments are ordered, keyword arguments should be the last in definition. do you know how to slice a list?</p>
| 2 | 2009-07-05T18:33:38Z | [
"python"
] |
Getting a dict out of a method? | 1,084,566 | <p>I'm trying to get a <code>dict</code> out of a method, so far I'm able to get the method name, and its arguments (using the inspect module), the problem I'm facing is that I'd like to have the default arguments too (or the argument type).</p>
<p>This is basically my unit test:</p>
<pre><code>class Test:
def me... | 1 | 2009-07-05T18:17:23Z | 1,084,624 | <p>Here is what I usually do:</p>
<pre><code>import inspect, itertools
args, varargs, keywords, defaults = inspect.getargspec(method1)
print dict(itertools.izip_longest(args[::-1], defaults[::-1], fillvalue=None))
</code></pre>
<p>--></p>
<pre><code>{'integer': 12, 'array': [], 'anon_type': None, 'obj': None, 'strin... | 1 | 2009-07-05T18:50:01Z | [
"python"
] |
Django Database Caching | 1,084,569 | <p>I'm working on a small project, and I wanted to provide multiple caching options to the end user. I figured with Django it's pretty simplistic to swap memcached for database or file based caching. My memcached implementation works like a champ without any issues. I placed time stamps on my pages, and curl consistent... | 3 | 2009-07-05T18:19:09Z | 1,084,583 | <p>According to the documentation you're supposed to create the table not by using syncdb but with the following:</p>
<pre><code>python manage.py createcachetable cache_table
</code></pre>
<p>If you haven't done that, try and see if it doesn't work.</p>
| 7 | 2009-07-05T18:30:48Z | [
"python",
"django",
"django-cache"
] |
Python: deep appending to dictionary? - in a single expression | 1,084,678 | <p>How do I, in a <strong>single expression</strong>, get a dictionary
where one key-value pair has been added to a sub-dictionary
in some input dictionary? The input dictionary should be left unchanged. It
can be assumed the sub-dictionary does exist and that the new key-value pair is not already in the sub-dictiona... | 8 | 2009-07-05T19:33:01Z | 1,084,688 | <pre><code>SOsurvivalConditions['firstCondition']['synonym'] = 'A modern form of RTFM is: Google It.'
</code></pre>
| 5 | 2009-07-05T19:39:11Z | [
"python"
] |
Python: deep appending to dictionary? - in a single expression | 1,084,678 | <p>How do I, in a <strong>single expression</strong>, get a dictionary
where one key-value pair has been added to a sub-dictionary
in some input dictionary? The input dictionary should be left unchanged. It
can be assumed the sub-dictionary does exist and that the new key-value pair is not already in the sub-dictiona... | 8 | 2009-07-05T19:33:01Z | 1,084,691 | <p>Are you looking for <code>dict.update</code> (documentation <a href="http://docs.python.org/library/stdtypes.html#dict.update" rel="nofollow">here</a>)?</p>
<pre><code>SOsurvivalConditions['firstCondition'].update({'synonym': 'A modern form of RTFM is: Google It.'})
</code></pre>
<p>is what, I think, you want.</p>... | 2 | 2009-07-05T19:39:54Z | [
"python"
] |
Python: deep appending to dictionary? - in a single expression | 1,084,678 | <p>How do I, in a <strong>single expression</strong>, get a dictionary
where one key-value pair has been added to a sub-dictionary
in some input dictionary? The input dictionary should be left unchanged. It
can be assumed the sub-dictionary does exist and that the new key-value pair is not already in the sub-dictiona... | 8 | 2009-07-05T19:33:01Z | 1,084,736 | <p>This works, but it's not pretty, and I think you are probably going too far with your lambda/oneliner/whatever you are trying to do :)</p>
<pre><code>dict((k,dict(v, synonym='A modern form of RTFM is: Google It.') if k == "firstCondition" else v) for k,v in SOsurvivalConditions.iteritems())
</code></pre>
| 1 | 2009-07-05T20:11:19Z | [
"python"
] |
Python: deep appending to dictionary? - in a single expression | 1,084,678 | <p>How do I, in a <strong>single expression</strong>, get a dictionary
where one key-value pair has been added to a sub-dictionary
in some input dictionary? The input dictionary should be left unchanged. It
can be assumed the sub-dictionary does exist and that the new key-value pair is not already in the sub-dictiona... | 8 | 2009-07-05T19:33:01Z | 1,084,946 | <p>Here's one that does meet your peculiar specs (to within the ambiguity with which you've specified them):</p>
<pre><code>(SOsurvivalConditions['firstCondition'].setdefault('synonym', 'A modern form of RTFM is: Google It.'), SOsurvivalConditions)[-1]
</code></pre>
<p>This does modify the initial data structures (ra... | 3 | 2009-07-05T22:21:17Z | [
"python"
] |
Python: deep appending to dictionary? - in a single expression | 1,084,678 | <p>How do I, in a <strong>single expression</strong>, get a dictionary
where one key-value pair has been added to a sub-dictionary
in some input dictionary? The input dictionary should be left unchanged. It
can be assumed the sub-dictionary does exist and that the new key-value pair is not already in the sub-dictiona... | 8 | 2009-07-05T19:33:01Z | 38,981,453 | <p>Python 3 is your friend:</p>
<pre><code>{**SOsurvivalConditions, 'firstCondition': {**SOsurvivalConditions['firstCondition'], 'synonym': 'A modern form of RTFM is: Google It.'}}
</code></pre>
<p>A single line expression that returns a dictionary with the additional subitem without modifying the original dictionary... | 1 | 2016-08-16T17:54:37Z | [
"python"
] |
Python: deep appending to dictionary? - in a single expression | 1,084,678 | <p>How do I, in a <strong>single expression</strong>, get a dictionary
where one key-value pair has been added to a sub-dictionary
in some input dictionary? The input dictionary should be left unchanged. It
can be assumed the sub-dictionary does exist and that the new key-value pair is not already in the sub-dictiona... | 8 | 2009-07-05T19:33:01Z | 38,982,579 | <p>I believe this meets your requirements:</p>
<pre><code>{k: dict(v, **{'synonym': 'A modern form of RTFM is: Google It.'}) if k == 'firstCondition' else v for k, v in SOsurvivalConditions.iteritems()}
</code></pre>
<p>This will produce a new dictionary that takes the inner dictionary of the original under <code>fir... | 1 | 2016-08-16T19:02:06Z | [
"python"
] |
How do I store desktop application data in a cross platform way for python? | 1,084,697 | <p>I have a python desktop application that needs to store user data. On Windows, this is usually in <code>%USERPROFILE%\Application Data\AppName\</code>, on OSX it's usually <code>~/Library/Application Support/AppName/</code>, and on other *nixes it's usually <code>~/.appname/</code>.</p>
<p>There exists a function i... | 37 | 2009-07-05T19:45:44Z | 1,084,700 | <p>Well, for Windows APPDATA (environmental variable) points to a user's "Application Data" folder. Not sure about OSX, though.</p>
<p>The correct way, in my opinion, is to do it on a per-platform basis.</p>
| 1 | 2009-07-05T19:50:27Z | [
"python",
"desktop-application",
"application-settings"
] |
How do I store desktop application data in a cross platform way for python? | 1,084,697 | <p>I have a python desktop application that needs to store user data. On Windows, this is usually in <code>%USERPROFILE%\Application Data\AppName\</code>, on OSX it's usually <code>~/Library/Application Support/AppName/</code>, and on other *nixes it's usually <code>~/.appname/</code>.</p>
<p>There exists a function i... | 37 | 2009-07-05T19:45:44Z | 1,088,459 | <p>Well, I hate to have been the one to answer my own question, but no one else seems to know. I'm leaving the answer for posterity.</p>
<pre><code>APPNAME = "MyApp"
import sys
from os import path, environ
if sys.platform == 'darwin':
from AppKit import NSSearchPathForDirectoriesInDomains
# http://developer.a... | 37 | 2009-07-06T18:14:36Z | [
"python",
"desktop-application",
"application-settings"
] |
How do I store desktop application data in a cross platform way for python? | 1,084,697 | <p>I have a python desktop application that needs to store user data. On Windows, this is usually in <code>%USERPROFILE%\Application Data\AppName\</code>, on OSX it's usually <code>~/Library/Application Support/AppName/</code>, and on other *nixes it's usually <code>~/.appname/</code>.</p>
<p>There exists a function i... | 37 | 2009-07-05T19:45:44Z | 14,026,484 | <p>You can try to use <a href="http://qt-project.org/doc/qt-5/qsettings.html" rel="nofollow"><code>QSettings</code></a> from Qt. You can obtain the path to your MyCompany/MyApp.ini file this way:</p>
<pre><code>from PySide.QtCore import QSettings, QCoreApplication
QSettings.setDefaultFormat(QSettings.IniFormat)
QCore... | 4 | 2012-12-24T23:30:42Z | [
"python",
"desktop-application",
"application-settings"
] |
How do I store desktop application data in a cross platform way for python? | 1,084,697 | <p>I have a python desktop application that needs to store user data. On Windows, this is usually in <code>%USERPROFILE%\Application Data\AppName\</code>, on OSX it's usually <code>~/Library/Application Support/AppName/</code>, and on other *nixes it's usually <code>~/.appname/</code>.</p>
<p>There exists a function i... | 37 | 2009-07-05T19:45:44Z | 33,735,209 | <p>a small module that does exactly that:</p>
<p><a href="https://pypi.python.org/pypi/appdirs/1.4.0" rel="nofollow">https://pypi.python.org/pypi/appdirs/1.4.0</a></p>
| 4 | 2015-11-16T12:18:36Z | [
"python",
"desktop-application",
"application-settings"
] |
C++ or Python as a starting point into GUI programming? | 1,084,935 | <p>I have neglected my programming skills since i left school and now i want to start a few things that are running around in my head. Qt would be the toolkit for me to use but i am undecided if i should use Python (looks to me like the easier to learn with a few general ideas about programming) or C++ (the thing to us... | 7 | 2009-07-05T22:13:19Z | 1,084,948 | <p>I have read <a href="http://www.qtrac.eu/pyqtbook.html" rel="nofollow">Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming by Mark Summerfield</a> , it's cool.
for C++ : C++ GUI Programming with Qt 4 (2nd Edition)
just my two cents. </p>
| 4 | 2009-07-05T22:21:41Z | [
"c++",
"python",
"qt"
] |
C++ or Python as a starting point into GUI programming? | 1,084,935 | <p>I have neglected my programming skills since i left school and now i want to start a few things that are running around in my head. Qt would be the toolkit for me to use but i am undecided if i should use Python (looks to me like the easier to learn with a few general ideas about programming) or C++ (the thing to us... | 7 | 2009-07-05T22:13:19Z | 1,084,952 | <p><a href="http://wiki.python.org/moin/PyQt" rel="nofollow">http://wiki.python.org/moin/PyQt</a><br />
You can use PyQT for Qt in Python. They have recommendations for tutorials and references on there.</p>
<p>Google "How to learn Qt" and "Learning C++".
There are some decent sources on there.</p>
| 4 | 2009-07-05T22:24:41Z | [
"c++",
"python",
"qt"
] |
C++ or Python as a starting point into GUI programming? | 1,084,935 | <p>I have neglected my programming skills since i left school and now i want to start a few things that are running around in my head. Qt would be the toolkit for me to use but i am undecided if i should use Python (looks to me like the easier to learn with a few general ideas about programming) or C++ (the thing to us... | 7 | 2009-07-05T22:13:19Z | 1,084,958 | <p>Being an expert in both C++ and Python, my mantra has long been "Python where I can, C++ where I must": Python is faster (in term of programmer productivity and development cycle) and easier, C++ can give that extra bit of power when I have to get close to the hardware or be extremely careful about every byte or mac... | 22 | 2009-07-05T22:30:35Z | [
"c++",
"python",
"qt"
] |
C++ or Python as a starting point into GUI programming? | 1,084,935 | <p>I have neglected my programming skills since i left school and now i want to start a few things that are running around in my head. Qt would be the toolkit for me to use but i am undecided if i should use Python (looks to me like the easier to learn with a few general ideas about programming) or C++ (the thing to us... | 7 | 2009-07-05T22:13:19Z | 1,084,964 | <p>How about Ruby? You can write Qt apps in Ruby allegedly (<a href="http://rubyforge.org/projects/korundum" rel="nofollow">http://rubyforge.org/projects/korundum</a>), and it gives you a good excuse to look at the very excellent "Why's Poignant Guide..." (<a href="http://poignantguide.net" rel="nofollow">http://poigna... | -1 | 2009-07-05T22:31:24Z | [
"c++",
"python",
"qt"
] |
Python: How can I import all variables? | 1,084,977 | <p>I'm new to Python and programming in general (a couple of weeks at most).</p>
<p>Concerning Python and using modules, I realise that functions can imported using <code>from a import *</code>.</p>
<p>So instead of typing</p>
<pre><code>a.sayHi()
a.sayBye()
</code></pre>
<p>I can say</p>
<pre><code>sayHi()
sayBye... | 18 | 2009-07-05T22:41:16Z | 1,084,984 | <p>You gave the solution yourself: <code>from a import *</code> will work just fine. Python does not differentiate between functions and variables in this respect.</p>
<pre><code>>>> from a import *
>>> if name == "Michael" and age == 15:
... print('Simple!')
...
Simple!
</code></pre>
| 40 | 2009-07-05T22:45:25Z | [
"python",
"variables",
"import",
"module"
] |
Python: How can I import all variables? | 1,084,977 | <p>I'm new to Python and programming in general (a couple of weeks at most).</p>
<p>Concerning Python and using modules, I realise that functions can imported using <code>from a import *</code>.</p>
<p>So instead of typing</p>
<pre><code>a.sayHi()
a.sayBye()
</code></pre>
<p>I can say</p>
<pre><code>sayHi()
sayBye... | 18 | 2009-07-05T22:41:16Z | 1,084,996 | <p>You didn't say this directly, but I'm assuming you're having trouble with manipulating these global variables.</p>
<p>If you manipulate global variables from inside a function, you must declare them global</p>
<pre><code>a = 10
def x():
global a
a = 15
print a
x()
print a
</code></pre>
<p>If you don't do t... | 7 | 2009-07-05T22:51:08Z | [
"python",
"variables",
"import",
"module"
] |
Python: How can I import all variables? | 1,084,977 | <p>I'm new to Python and programming in general (a couple of weeks at most).</p>
<p>Concerning Python and using modules, I realise that functions can imported using <code>from a import *</code>.</p>
<p>So instead of typing</p>
<pre><code>a.sayHi()
a.sayBye()
</code></pre>
<p>I can say</p>
<pre><code>sayHi()
sayBye... | 18 | 2009-07-05T22:41:16Z | 1,086,390 | <p>Just for some context, most linters will flag <code>from module import *</code> with a warning, because it's prone to namespace collisions that will cause headaches down the road.</p>
<p>Nobody has noted yet that, as an alternative, you can use the</p>
<pre><code>from a import name, age
</code></pre>
<p>form and ... | 21 | 2009-07-06T10:33:08Z | [
"python",
"variables",
"import",
"module"
] |
Python: How can I import all variables? | 1,084,977 | <p>I'm new to Python and programming in general (a couple of weeks at most).</p>
<p>Concerning Python and using modules, I realise that functions can imported using <code>from a import *</code>.</p>
<p>So instead of typing</p>
<pre><code>a.sayHi()
a.sayBye()
</code></pre>
<p>I can say</p>
<pre><code>sayHi()
sayBye... | 18 | 2009-07-05T22:41:16Z | 1,086,705 | <p>Like others have said,</p>
<pre><code>from module import *
</code></pre>
<p>will also import the modules variables.</p>
<p>However, you need to understand that you are <em>not</em> importing variables, just references to objects. Assigning something else to the imported names in the importing module <strong>won't... | 11 | 2009-07-06T12:28:24Z | [
"python",
"variables",
"import",
"module"
] |
How do I use TLS with asyncore? | 1,085,050 | <p>An asyncore-based XMPP client opens a normal TCP connection to an XMPP server. The server indicates it requires an encrypted connection. The client is now expected to start a TLS handshake so that subsequent requests can be encrypted.</p>
<p><a href="http://trevp.net/tlslite/readme.txt" rel="nofollow">tlslite</a> i... | 3 | 2009-07-05T23:23:06Z | 1,085,246 | <p>I've followed what I believe are all the steps tlslite documents to make an asyncore client work -- I can't actually get it to work since the only asyncore client I have at hand to tweak for the purpose is the example in the Python docs, which is an HTTP 1.0 client, and I believe that because of this I'm trying to s... | 2 | 2009-07-06T03:05:37Z | [
"python",
"ssl"
] |
How do I use TLS with asyncore? | 1,085,050 | <p>An asyncore-based XMPP client opens a normal TCP connection to an XMPP server. The server indicates it requires an encrypted connection. The client is now expected to start a TLS handshake so that subsequent requests can be encrypted.</p>
<p><a href="http://trevp.net/tlslite/readme.txt" rel="nofollow">tlslite</a> i... | 3 | 2009-07-05T23:23:06Z | 1,085,862 | <p>Definitely check out twisted and wokkel. I've been building tons of xmpp bots and components with it and it's a dream.</p>
| 4 | 2009-07-06T07:54:16Z | [
"python",
"ssl"
] |
Problem with printing contents of a list | 1,085,051 | <p>I'm having a somewhat odd problem with Python(2.6.2) <del>that I've come to the conclusion is a bug in the Vista port (I cant replicate it in XP or Linux).</del></p>
<p>I have a list of users, encrypted passwords, and their host that I am storing in a larger list (it's acting as a sort of database).</p>
<p>This al... | 1 | 2009-07-05T23:23:50Z | 1,085,059 | <p>Your file users.txt is in UTF-16, but you're opening it as ASCII.</p>
<p>Either change it to ASCII, or open it like this:</p>
<pre><code>import codecs
users = codecs.open( "users-16.txt", "r", "utf-16" )
</code></pre>
| 6 | 2009-07-05T23:25:26Z | [
"python"
] |
Problem with printing contents of a list | 1,085,051 | <p>I'm having a somewhat odd problem with Python(2.6.2) <del>that I've come to the conclusion is a bug in the Vista port (I cant replicate it in XP or Linux).</del></p>
<p>I have a list of users, encrypted passwords, and their host that I am storing in a larger list (it's acting as a sort of database).</p>
<p>This al... | 1 | 2009-07-05T23:23:50Z | 1,085,066 | <p>Try replacing</p>
<pre><code>create_user( user )
</code></pre>
<p>with</p>
<pre><code>create_user( user.decode("utf16") )
</code></pre>
| 1 | 2009-07-05T23:28:28Z | [
"python"
] |
Real-time intercepting of stdout from another process in Python | 1,085,071 | <p>I'd like to run a system process, intercept the output, and modify it real-time, line by line, in a Python script.</p>
<p>My best attempt, which waits for the process to complete before printing, is:</p>
<pre><code>#!/usr/bin/env python
import subprocess
cmd = "waitsome.py"
proc = subprocess.Popen(cmd, shell=True... | 3 | 2009-07-05T23:31:08Z | 1,085,100 | <p>Looping over a file unavoidably buffers things in pretty large chunks -- a known issue with all Python 2.* implementations. It works as you intend in Python 3.1, with the final loop being slightly different:</p>
<pre><code>for line in proc.stdout:
print(">>> " + str(line.rstrip()))
</code></pre>
<p>If... | 12 | 2009-07-06T01:51:07Z | [
"python",
"perl",
"process"
] |
Python sqlachemy - how to make table partitions? | 1,085,304 | <p>I am not very familiar with databases, and so I do not know how to partition a table using sqlachemy...</p>
<p>Your help would be greatly appreciated.</p>
| 0 | 2009-07-06T03:33:04Z | 1,085,318 | <p>It's quite an advanced subject for somebody not familiar with databases, but try Essential SQLAlchemy (you can read the key parts on <a href="http://books.google.com/books?id=septpU7dELIC&pg=PR5&lpg=PR5&dq=sqlalchemy+partition+table&source=bl&ots=0zv-uP1ckD&sig=gnaIpZPQA05lT6-FwL-BIFd-5Kg&... | 3 | 2009-07-06T03:41:36Z | [
"python",
"sqlalchemy"
] |
Python sqlachemy - how to make table partitions? | 1,085,304 | <p>I am not very familiar with databases, and so I do not know how to partition a table using sqlachemy...</p>
<p>Your help would be greatly appreciated.</p>
| 0 | 2009-07-06T03:33:04Z | 1,086,985 | <p>There are two kinds of partitioning: Vertical Partitioning and Horizontal Partitioning.</p>
<p>From the <a href="http://docs.sqlalchemy.org/en/rel_0_9/orm/session.html#partitioning-strategies" rel="nofollow">docs</a>:</p>
<blockquote>
<h1>Vertical Partitioning</h1>
<p>Vertical partitioning places different
... | 4 | 2009-07-06T13:32:30Z | [
"python",
"sqlalchemy"
] |
Python sqlachemy - how to make table partitions? | 1,085,304 | <p>I am not very familiar with databases, and so I do not know how to partition a table using sqlachemy...</p>
<p>Your help would be greatly appreciated.</p>
| 0 | 2009-07-06T03:33:04Z | 1,087,081 | <p>Automatic partitioning is a very database engine specific concept and SQLAlchemy doesn't provide any generic tools to manage partitioning. Mostly because it wouldn't provide anything really useful while being another API to learn. If you want to do database level partitioning then do the CREATE TABLE statements usin... | 2 | 2009-07-06T13:48:20Z | [
"python",
"sqlalchemy"
] |
game design - handling bonuses / duck typing - python | 1,085,532 | <p>I am currently faced with a design problem in my game design, not terrible but it bothers me enough so I want to ask others opinions :-)</p>
<p>I am currently experimenting with pygame, I have developed a little space shooter and now I would like to handle some bonuses.</p>
<p>Right now I have an abstract class Bo... | 4 | 2009-07-06T05:18:18Z | 1,085,541 | <p>If you don't want a certain <code>col</code> to go in <code>player.bonuses</code> but elsewhere, make a <code>toplayer</code> method in the abstract class <code>Bonus</code> with the default implementation:</p>
<pre><code>def toplayer(self, player):
player.bonuses.append(self)
</code></pre>
<p>and override it ... | 1 | 2009-07-06T05:24:22Z | [
"python",
"pygame",
"duck-typing"
] |
game design - handling bonuses / duck typing - python | 1,085,532 | <p>I am currently faced with a design problem in my game design, not terrible but it bothers me enough so I want to ask others opinions :-)</p>
<p>I am currently experimenting with pygame, I have developed a little space shooter and now I would like to handle some bonuses.</p>
<p>Right now I have an abstract class Bo... | 4 | 2009-07-06T05:18:18Z | 1,085,545 | <p>I don't write in python but here's my recommendation: Load up your player with each type of weapon he can get (even ones through bonuses) and set the ammo on the ones that he gets through bonuses to 0. Then when your player picks up a "bomb bonus" (or whatever) add one ammo to the bomb weapon on the player. That oug... | 1 | 2009-07-06T05:25:37Z | [
"python",
"pygame",
"duck-typing"
] |
game design - handling bonuses / duck typing - python | 1,085,532 | <p>I am currently faced with a design problem in my game design, not terrible but it bothers me enough so I want to ask others opinions :-)</p>
<p>I am currently experimenting with pygame, I have developed a little space shooter and now I would like to handle some bonuses.</p>
<p>Right now I have an abstract class Bo... | 4 | 2009-07-06T05:18:18Z | 1,085,567 | <p>I think you're on the right track - I would say the "Bomb Bonus" is still related to the player object because it affects the enemies around the player. You just need to implement the "Bomb Bonus"'s <code>use()</code> method like this:</p>
<pre><code>class BombBonus(Bonus):
def use(self, player):
assert... | 0 | 2009-07-06T05:37:29Z | [
"python",
"pygame",
"duck-typing"
] |
game design - handling bonuses / duck typing - python | 1,085,532 | <p>I am currently faced with a design problem in my game design, not terrible but it bothers me enough so I want to ask others opinions :-)</p>
<p>I am currently experimenting with pygame, I have developed a little space shooter and now I would like to handle some bonuses.</p>
<p>Right now I have an abstract class Bo... | 4 | 2009-07-06T05:18:18Z | 1,846,212 | <p>I had a bonus system in an asteroid clone I wrote a few years ago. It lives (as much as a dead project can live) on <a href="http://bitbucket.org/mizipzor/pyroids/" rel="nofollow">Bitbucket</a> now. I dont think its as flexible as you seem to be aiming for. But small <a href="http://bitbucket.org/mizipzor/pyroids/sr... | 0 | 2009-12-04T10:51:18Z | [
"python",
"pygame",
"duck-typing"
] |
How to check available Python libraries on Google App Engine & add more | 1,085,538 | <p>How to check available Python libraries on Google App Engine & add more?</p>
<p>Is SQLite available or we must use GQL with their database system only?</p>
<p>Thank you in advance.</p>
| 1 | 2009-07-06T05:23:58Z | 1,085,550 | <p>Afaik, you can only use the GAE specific database.</p>
| 1 | 2009-07-06T05:28:36Z | [
"python",
"google-app-engine",
"sqlite"
] |
How to check available Python libraries on Google App Engine & add more | 1,085,538 | <p>How to check available Python libraries on Google App Engine & add more?</p>
<p>Is SQLite available or we must use GQL with their database system only?</p>
<p>Thank you in advance.</p>
| 1 | 2009-07-06T05:23:58Z | 1,085,554 | <p>SQLite is there (but since you cannot write to files, you must use it in a read-only way, or on a <code>:memory:</code> database).</p>
<p>App engine <a href="http://code.google.com/appengine/docs/python/runtime.html#Pure%5FPython" rel="nofollow">docs</a> do a good job at documenting what's there. You can add any ot... | 4 | 2009-07-06T05:30:18Z | [
"python",
"google-app-engine",
"sqlite"
] |
What's the simplest way to put a python script into the system tray (Windows) | 1,085,694 | <p>What's the simplest way to put a python script into the system tray?</p>
<p>My target platform is Windows. I don't want to see the 'cmd.exe' window.</p>
| 31 | 2009-07-06T06:38:43Z | 1,085,718 | <p>Those are two questions, actually:</p>
<ol>
<li>Adding a tray icon can be done with Win32 API. Example: <a href="http://www.brunningonline.net/simon/blog/archives/SysTrayIcon.py.html">SysTrayIcon.py</a></li>
<li>Hiding the <code>cmd.exe</code> window is as easy as using <code>pythonw.exe</code> instead of <code>pyt... | 44 | 2009-07-06T06:49:41Z | [
"python",
"system-tray"
] |
Does sphinx run on Jython? | 1,085,791 | <p>I'm still looking for a usable documentation tool chain. Working in the Java environment but also a Python user, I wondered if <a href="http://sphinx.pocoo.org/">Sphinx</a> would run on <a href="http://www.jython.org/">Jython</a> 2.5?</p>
| 6 | 2009-07-06T07:20:24Z | 1,085,966 | <p>I think the easiest thing to do is to try it ? I can't find anything that says it won't.</p>
| 1 | 2009-07-06T08:22:25Z | [
"java",
"python",
"documentation",
"jython"
] |
Does sphinx run on Jython? | 1,085,791 | <p>I'm still looking for a usable documentation tool chain. Working in the Java environment but also a Python user, I wondered if <a href="http://sphinx.pocoo.org/">Sphinx</a> would run on <a href="http://www.jython.org/">Jython</a> 2.5?</p>
| 6 | 2009-07-06T07:20:24Z | 1,086,231 | <p>There are many <a href="http://jython.sourceforge.net/docs/differences.html" rel="nofollow">differences between CPython and Jython</a>, so I'd recommend you to run Sphinx unit tests on Jython to see picture.</p>
<p>Good luck!</p>
| 1 | 2009-07-06T09:39:36Z | [
"java",
"python",
"documentation",
"jython"
] |
Does sphinx run on Jython? | 1,085,791 | <p>I'm still looking for a usable documentation tool chain. Working in the Java environment but also a Python user, I wondered if <a href="http://sphinx.pocoo.org/">Sphinx</a> would run on <a href="http://www.jython.org/">Jython</a> 2.5?</p>
| 6 | 2009-07-06T07:20:24Z | 1,486,504 | <p>Running Jython 2.5.1 with Sphinx in an Ant-script shows an error:</p>
<pre><code> [exec] Making output directory...
[exec] Running Sphinx v0.6.3
[exec] Exception occurred:
[exec] File "C:\jython\jython2.5.1\Lib\site-packages\sphinx-0.6.3-py2.5.egg\sphinx\highlighting.py", line 15, in <module... | 3 | 2009-09-28T11:08:38Z | [
"java",
"python",
"documentation",
"jython"
] |
Does sphinx run on Jython? | 1,085,791 | <p>I'm still looking for a usable documentation tool chain. Working in the Java environment but also a Python user, I wondered if <a href="http://sphinx.pocoo.org/">Sphinx</a> would run on <a href="http://www.jython.org/">Jython</a> 2.5?</p>
| 6 | 2009-07-06T07:20:24Z | 1,487,066 | <p>to run sphinx on jython i had to do some changes:</p>
<ol>
<li><p>in the highlighting.py file:</p>
<p>uncomment <code>import parser</code> [line 15?]</p>
<p>uncomment the use of parser in PygmentsBridge.try_parse
(<code>whole try / except</code> ) [line 159 - 164?]</p>
<p>add an <code>return True</code> to Pygme... | 3 | 2009-09-28T13:34:40Z | [
"java",
"python",
"documentation",
"jython"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.