title stringlengths 10 172 | question_id int64 469 40.1M | question_body stringlengths 22 48.2k | question_score int64 -44 5.52k | question_date stringlengths 20 20 | answer_id int64 497 40.1M | answer_body stringlengths 18 33.9k | answer_score int64 -38 8.38k | answer_date stringlengths 20 20 | tags listlengths 1 5 |
|---|---|---|---|---|---|---|---|---|---|
How to install MySQLdb (Python data access library to MySQL) on Mac OS X? | 1,448,429 | <p>I'm a Python newbie, but I've just spent a day working out how to get MySQLdb working properly, and the universe according to google includes numerous references to what a PITA it is, and an inordinate number of guides that seem to be outdated. Given that this site is intended to address these sorts of problems, an... | 81 | 2009-09-19T12:04:41Z | 22,513,919 | <p>As statend on <a href="http://stackoverflow.com/questions/17599830/installing-mysql-python-on-mac">Installing MySQL-python on mac</a> :</p>
<pre><code>pip uninstall MySQL-python
brew install mysql
pip install MySQL-python
</code></pre>
<p>Then test it :</p>
<pre><code>python -c "import MySQLdb"
</code></pre>
| 4 | 2014-03-19T17:41:07Z | [
"python",
"mysql",
"osx"
] |
How to install MySQLdb (Python data access library to MySQL) on Mac OS X? | 1,448,429 | <p>I'm a Python newbie, but I've just spent a day working out how to get MySQLdb working properly, and the universe according to google includes numerous references to what a PITA it is, and an inordinate number of guides that seem to be outdated. Given that this site is intended to address these sorts of problems, an... | 81 | 2009-09-19T12:04:41Z | 22,886,248 | <p>You could try using the pure-python <code>pymysql</code>:</p>
<pre><code>sudo easy_install pymysql
</code></pre>
<p>(Or use <code>pip</code> if you have it installed.) Then, add this before you <code>import MySQLdb</code> in your code:</p>
<pre><code>try:
import pymysql
pymysql.install_as_MySQLdb()
except... | 0 | 2014-04-05T20:15:32Z | [
"python",
"mysql",
"osx"
] |
How to install MySQLdb (Python data access library to MySQL) on Mac OS X? | 1,448,429 | <p>I'm a Python newbie, but I've just spent a day working out how to get MySQLdb working properly, and the universe according to google includes numerous references to what a PITA it is, and an inordinate number of guides that seem to be outdated. Given that this site is intended to address these sorts of problems, an... | 81 | 2009-09-19T12:04:41Z | 23,849,606 | <p>Or simple try:</p>
<blockquote>
<p>sudo easy_install MySQL-python</p>
</blockquote>
<p>If it gives a error</p>
<p>EnvironmentError: mysql_config not found</p>
<p>Just run this </p>
<blockquote>
<p>export PATH=$PATH:/usr/local/mysql/bin</p>
</blockquote>
| 1 | 2014-05-24T20:59:40Z | [
"python",
"mysql",
"osx"
] |
How to install MySQLdb (Python data access library to MySQL) on Mac OS X? | 1,448,429 | <p>I'm a Python newbie, but I've just spent a day working out how to get MySQLdb working properly, and the universe according to google includes numerous references to what a PITA it is, and an inordinate number of guides that seem to be outdated. Given that this site is intended to address these sorts of problems, an... | 81 | 2009-09-19T12:04:41Z | 23,869,683 | <pre><code>export PATH=$PATH:/usr/local/mysql/bin/
</code></pre>
<p>should fix the issue for you as the system is not able to find the mysql_config file.</p>
| 0 | 2014-05-26T12:00:14Z | [
"python",
"mysql",
"osx"
] |
Python - I can't stop the program running | 1,448,505 | <p>I am completely new to python. I have installed it on windows. I am having a problem, I write:</p>
<pre><code>from pylab import*
subplot(111,projection="hammer")
show()
</code></pre>
<p>After this it will not let me do anything else and ctrl-c does not work. I have looked at another post here and tried ctrl-brea... | 1 | 2009-09-19T12:48:14Z | 1,448,542 | <p>If it's a simple matter of interrupting a running program, have you tried CTRL-D ?</p>
| 0 | 2009-09-19T13:14:01Z | [
"python"
] |
Python - I can't stop the program running | 1,448,505 | <p>I am completely new to python. I have installed it on windows. I am having a problem, I write:</p>
<pre><code>from pylab import*
subplot(111,projection="hammer")
show()
</code></pre>
<p>After this it will not let me do anything else and ctrl-c does not work. I have looked at another post here and tried ctrl-brea... | 1 | 2009-09-19T12:48:14Z | 1,448,543 | <p>I'd recommend to use <a href="http://ipython.scipy.org/moin/" rel="nofollow">IPython</a>. It brings a matplotlib/pylab mode that handles all this for you. After you install IPython, you can start it with the <code>pylab</code> flag:</p>
<pre><code>$ ipython -pylab
</code></pre>
<p>Then, in the interactive shell, y... | 1 | 2009-09-19T13:14:29Z | [
"python"
] |
Python - I can't stop the program running | 1,448,505 | <p>I am completely new to python. I have installed it on windows. I am having a problem, I write:</p>
<pre><code>from pylab import*
subplot(111,projection="hammer")
show()
</code></pre>
<p>After this it will not let me do anything else and ctrl-c does not work. I have looked at another post here and tried ctrl-brea... | 1 | 2009-09-19T12:48:14Z | 1,448,556 | <p>Try this:</p>
<p>After all of your imports for pylab and what not.. add:</p>
<pre><code>import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
</code></pre>
<p>This will cause CTRL-C to not be caught by anything in your program, which should then cause it to kill the program.</p>
| 0 | 2009-09-19T13:25:47Z | [
"python"
] |
Python - I can't stop the program running | 1,448,505 | <p>I am completely new to python. I have installed it on windows. I am having a problem, I write:</p>
<pre><code>from pylab import*
subplot(111,projection="hammer")
show()
</code></pre>
<p>After this it will not let me do anything else and ctrl-c does not work. I have looked at another post here and tried ctrl-brea... | 1 | 2009-09-19T12:48:14Z | 1,448,648 | <p>Try catching <code>KeyboardInterrupt</code> like so:</p>
<pre><code>try:
show()
except KeyboardInterrupt:
print "Shutting down."
import sys
sys.exit()
</code></pre>
| 0 | 2009-09-19T14:27:22Z | [
"python"
] |
Python subprocess.Popen - adding GCC flags results in "no input files" error | 1,448,558 | <p>I'm building a Python script to automate my build process, which invokes GCC using subprocess.Popen. My initial attempt works fine.</p>
<pre><code>>>> import subprocess
>>> p = Popen(['gcc', 'hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
>>> p.wait()
0
>>> ... | 2 | 2009-09-19T13:27:20Z | 1,448,567 | <p>Shouldn't that be</p>
<pre><code>p = Popen(['gcc', '-o', 'hello', 'hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
</code></pre>
| 6 | 2009-09-19T13:33:19Z | [
"python",
"gcc",
"subprocess",
"popen"
] |
Multiple visualizations in one page | 1,448,638 | <p>I am using python-visualization library for computing the datasource.
I tried to put more than one visualization in a single page. Both are line charts and data comes from a seperate URLs for each visualizations.</p>
<pre><code><script type="text/javascript" src="http://www.google.com/jsapi"></script>
&... | 2 | 2009-09-19T14:24:52Z | 1,449,197 | <p>You can try something like </p>
<pre><code>function Charts(){
var self = this;
self.chart = [];
self.settings = { width: 650, height: 250 };
self.add = function(type, element, dataTable, options){
self.chart.push({
o: new google.visualization[type]($(element)[0]),
dat... | 0 | 2009-09-19T18:38:58Z | [
"javascript",
"jquery",
"python",
"django",
"google-visualization"
] |
Multiple visualizations in one page | 1,448,638 | <p>I am using python-visualization library for computing the datasource.
I tried to put more than one visualization in a single page. Both are line charts and data comes from a seperate URLs for each visualizations.</p>
<pre><code><script type="text/javascript" src="http://www.google.com/jsapi"></script>
&... | 2 | 2009-09-19T14:24:52Z | 3,850,573 | <p>Happened to me too. The solution was for the server to return the reqId parameter.
If you have two visualizations on the same page, one will have reqId 0 and the other reqId 1. make sure the server returns those reqIds back appropriately in the response.</p>
<p>If both responses return '0' then only one visualizati... | 0 | 2010-10-03T16:27:12Z | [
"javascript",
"jquery",
"python",
"django",
"google-visualization"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 1,448,832 | <p>What version of Python do you have? SQLite is integrated in Python since 2.5:</p>
<p><a href="http://docs.python.org/library/sqlite3.html" rel="nofollow">http://docs.python.org/library/sqlite3.html</a></p>
<p>If you insist on compiling it yourself, the package is called sqlite3-devel, you can find it e.g. <a href=... | 2 | 2009-09-19T16:02:39Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 1,448,856 | <p>I'm the one who answered the other question :) On systems that use RPM packages, i.e. you normally use 'yum' to install things, the package is named sqlite3-devel.</p>
<p>On most Debian based systems (i.e. you use apt-get to install packages), the package is named sqlite3-dev.</p>
<p>This is a very typical differe... | 0 | 2009-09-19T16:12:35Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 1,448,865 | <blockquote>
<p>how to check if I have "sqlite3-dev"</p>
</blockquote>
<p>That's entirely dependent on what Linux distro you're using -- is it Fedora, Suse, Ubuntu, Gentoo, Mandrake, or which other one out of the dozens out there; there are several packaging strategies and tools used to check which packages are ther... | 3 | 2009-09-19T16:17:24Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 2,805,246 | <p>I had the same trouble with gcc failing with Ubuntu Karmic. I fixed this by installing the python-dev package. In my case, I'm working with python2.4, so I installed the python2.4-dev package. The python-dev package should work for python2.6.</p>
| 0 | 2010-05-10T18:17:09Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 3,999,614 | <p>I had the same problem, I'm using python 2.4, neither <code>sqlite3-dev</code> nor <code>libsqlite3-dev</code> are available for CentOS.</p>
<pre><code>yum install python-devel
</code></pre>
<p>seems to solve the issue.</p>
| 3 | 2010-10-22T18:01:50Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 5,896,406 | <p>I had following compile errors on <strong>CentOS release 5.6</strong>:</p>
<pre><code>src/cache.h:34: error: expected specifier-qualifier-list before 'PyObject_HEAD'
src/cache.h:44: error: expected specifier-qualifier-list before 'PyObject_HEAD'
src/cache.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__... | 1 | 2011-05-05T10:42:37Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 10,068,852 | <p>You could use yum or apt-get instead
first type :</p>
<pre><code> sudo yum(or apt-get) search python-sqlite3
</code></pre>
<p>you will get something like python-sqlite3dbm.noarch</p>
<p>then type :</p>
<pre><code> sudo yum(or apt-get) install python-sqlite3dbm.noarch
</code></pre>
<p>this way your os will... | 2 | 2012-04-09T04:21:43Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 12,262,783 | <p>Did you install the python sqlite lib?</p>
<pre><code>sudo apt-get install python-sqlite
</code></pre>
| 0 | 2012-09-04T11:42:26Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 18,519,411 | <p>I was able to resolve the same build error by installing the sqlite-devel package:</p>
<pre><code>sudo yum install sqlite-devel
</code></pre>
| 4 | 2013-08-29T19:23:04Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
How to install pysqlite? | 1,448,819 | <p>I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following:</p>
<pre><code>gunzip pysqlite-2.5.5.tar.gz
tar xvf pysqlite-2.5.5.tar
\cd pysqlite-2.5.5
python setup.py install
</code></pre>
<p>At the last step I have a pro... | 3 | 2009-09-19T15:55:09Z | 19,143,252 | <p>For Debian distros I fixed this problem with</p>
<pre><code>sudo apt-get install libsqlite3-dev
</code></pre>
| 6 | 2013-10-02T17:38:20Z | [
"python",
"linux",
"sqlite",
"gcc",
"pysqlite"
] |
variable length of %s with the % operator in python | 1,448,820 | <p>I'm trying to do this:</p>
<pre><code>max_title_width = max([len(text) for text in columns])
for column in columns:
print "%10s, blah" % column
</code></pre>
<p>But I want to replace the <code>10</code> with the value of <code>max_title_width</code>. How do I do this in the most pythonic way possible?</p>
| 18 | 2009-09-19T15:56:38Z | 1,448,834 | <p>This is a carryover from the C formatting markup:</p>
<pre><code>print "%*s, blah" % (max_title_width,column)
</code></pre>
<p>If you want left-justified text (for entries shorter than <code>max_title_width</code>), put a '-' before the '*'.</p>
<pre><code>>>> text = "abcdef"
>>> print "<%*s&... | 44 | 2009-09-19T16:03:17Z | [
"python"
] |
variable length of %s with the % operator in python | 1,448,820 | <p>I'm trying to do this:</p>
<pre><code>max_title_width = max([len(text) for text in columns])
for column in columns:
print "%10s, blah" % column
</code></pre>
<p>But I want to replace the <code>10</code> with the value of <code>max_title_width</code>. How do I do this in the most pythonic way possible?</p>
| 18 | 2009-09-19T15:56:38Z | 1,448,842 | <p>You have the new strings formatting methods from Python 3 and Python 2.6.</p>
<blockquote>
<p>Starting in Python 2.6, the built-in str and unicode classes provide the ability to do complex variable substitutions and value formatting via the str.format() method described in PEP 3101. The Formatter class in the str... | 22 | 2009-09-19T16:04:59Z | [
"python"
] |
variable length of %s with the % operator in python | 1,448,820 | <p>I'm trying to do this:</p>
<pre><code>max_title_width = max([len(text) for text in columns])
for column in columns:
print "%10s, blah" % column
</code></pre>
<p>But I want to replace the <code>10</code> with the value of <code>max_title_width</code>. How do I do this in the most pythonic way possible?</p>
| 18 | 2009-09-19T15:56:38Z | 1,448,844 | <p>you could create your template outside of the loop:</p>
<pre><code>tmpl = '%%%ds, blah' % max_title_width
for column in columns:
print tmpl % column
</code></pre>
<p>You could also learn about the <a href="http://docs.python.org/tutorial/inputoutput.html#input-and-output" rel="nofollow">new formatting</a> in p... | 2 | 2009-09-19T16:06:34Z | [
"python"
] |
variable length of %s with the % operator in python | 1,448,820 | <p>I'm trying to do this:</p>
<pre><code>max_title_width = max([len(text) for text in columns])
for column in columns:
print "%10s, blah" % column
</code></pre>
<p>But I want to replace the <code>10</code> with the value of <code>max_title_width</code>. How do I do this in the most pythonic way possible?</p>
| 18 | 2009-09-19T15:56:38Z | 18,036,492 | <p>Python 2.6+ alternate version examples:</p>
<pre><code>>>> '{:{n}s}, blah'.format('column', n=10)
'column , blah'
>>> '{:*>{l}s}'.format(password[-3:], l=len(password)) # password = 'stackoverflow'
'**********low'
>>> '{:,.{n}f} {}'.format(1234.567, 'USD', n=2)
'1,234.57 USD'
</code... | 3 | 2013-08-03T19:31:57Z | [
"python"
] |
subversion python bindings documentation? | 1,448,894 | <p>Where can I find a good introduction to using the subversion python bindings?</p>
<p>I found <a href="http://svnbook.red-bean.com/en/1.5/svn.developer.usingapi.html">one section in the svnbook</a> that talks about it; and some <a href="http://jtauber.com/python%5Fsubversion%5Fbinding/">basic examples from 1.3</a>.<... | 7 | 2009-09-19T16:32:18Z | 1,448,910 | <p>This looks like a pretty complete documentation:</p>
<p><a href="http://pysvn.tigris.org/docs/pysvn_prog_ref.html" rel="nofollow">http://pysvn.tigris.org/docs/pysvn_prog_ref.html</a></p>
<p>And here are a couple examples:</p>
<p><a href="http://svn.apache.org/repos/asf/subversion/trunk/tools/examples/" rel="nofol... | 1 | 2009-09-19T16:37:59Z | [
"python",
"svn",
"documentation"
] |
subversion python bindings documentation? | 1,448,894 | <p>Where can I find a good introduction to using the subversion python bindings?</p>
<p>I found <a href="http://svnbook.red-bean.com/en/1.5/svn.developer.usingapi.html">one section in the svnbook</a> that talks about it; and some <a href="http://jtauber.com/python%5Fsubversion%5Fbinding/">basic examples from 1.3</a>.<... | 7 | 2009-09-19T16:32:18Z | 7,356,388 | <p>If you build Subversion from source the Subversion Python bindings aren't automatically included. You have to specifically build and include them. Luckily, you can do this after you've installed Subversion. The source for the bindings is included within the Subversion source code. </p>
<p>These instructions are for... | 1 | 2011-09-09T01:55:12Z | [
"python",
"svn",
"documentation"
] |
subversion python bindings documentation? | 1,448,894 | <p>Where can I find a good introduction to using the subversion python bindings?</p>
<p>I found <a href="http://svnbook.red-bean.com/en/1.5/svn.developer.usingapi.html">one section in the svnbook</a> that talks about it; and some <a href="http://jtauber.com/python%5Fsubversion%5Fbinding/">basic examples from 1.3</a>.<... | 7 | 2009-09-19T16:32:18Z | 15,856,850 | <p>Just wanted to add a little clarification here. </p>
<p>Thanks to the above two answers (<a href="http://stackoverflow.com/a/1448910/277826">@BenjaminWohlwend</a> and <a href="http://stackoverflow.com/a/7356388/277826">@Logan</a>), I became aware there are more than one set of Python bindings/interfaces for Subvers... | 3 | 2013-04-06T22:42:00Z | [
"python",
"svn",
"documentation"
] |
subversion python bindings documentation? | 1,448,894 | <p>Where can I find a good introduction to using the subversion python bindings?</p>
<p>I found <a href="http://svnbook.red-bean.com/en/1.5/svn.developer.usingapi.html">one section in the svnbook</a> that talks about it; and some <a href="http://jtauber.com/python%5Fsubversion%5Fbinding/">basic examples from 1.3</a>.<... | 7 | 2009-09-19T16:32:18Z | 16,027,927 | <p>Hope it's OK with another post re: <code>python-subversion</code>: I wanted to try <a href="http://svnbook.red-bean.com/en/1.5/svn.developer.usingapi.html#svn.developer.usingapi.otherlangs.ex-2" rel="nofollow">Example 8.3. A Python status crawler - Using the APIs (svnbook)</a>. on Ubuntu 11.04, Python 2.7, <code>svn... | 0 | 2013-04-16T02:44:09Z | [
"python",
"svn",
"documentation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 1,449,170 | <p>If MySQLdb's now distributed in a way that requires <code>setuptools</code>, your choices are either to download the latter (e.g. from <a href="http://pypi.python.org/pypi/setuptools">here</a>) or refactor MySQLdb's setup.py to bypass <code>setuptools</code> (maybe just importing <code>setup</code> and <code>Extensi... | 15 | 2009-09-19T18:28:15Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 1,449,172 | <p>This was sort of tricky for me too, I did the following which worked pretty well.</p>
<ul>
<li>Download the appropriate Python .egg for setuptools (ie, for Python 2.6, you can get it <a href="http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg#md5=ca37b1ff16fa2ede6e19383e7b59245a">here</a>. ... | 5 | 2009-09-19T18:28:40Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 2,997,359 | <pre><code>#!/usr/bin/env python
import os
import sys
from **distutils.core** import setup, Extension
if sys.version_info < (2, 3):
raise Error("Python-2.3 or newer is required")
if os.name == "posix":
from setup_posix import get_config
else: # assume windows
from setup_windows import get_config
meta... | 2 | 2010-06-08T12:48:35Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 3,469,290 | <p>Also, you can see the build dependencies in the file setup.cfg</p>
| 1 | 2010-08-12T15:23:48Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 4,319,894 | <p>I resolved this issue on centos5.4 by running the following command to install setuptools</p>
<p>yum install python-setuptools</p>
<p>I hope that helps.</p>
| 11 | 2010-11-30T23:47:30Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 9,675,988 | <p>After trying many suggestions, simply using <code>sudo apt-get install python-mysqldb</code> worked for me.</p>
<p>More info:
<a href="http://stackoverflow.com/questions/2952187/getting-error-loading-mysqldb-module-no-module-named-mysqldb-have-tried-pre">Getting "Error loading MySQLdb module: No module named ... | 27 | 2012-03-12T22:57:07Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 11,645,913 | <p>I am experiencing the same problem right now. According to <a href="http://blog.flairpy.com/?p=19" rel="nofollow">this post</a> you need to have a C Compiler or GCC. I'll try to fix the problem by installing C compiler. I'll inform you if it works (we'll I guess you don't need it anymore, but I'll post the result an... | 1 | 2012-07-25T08:46:13Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 11,653,179 | <p>When you need to install modules in Linux/Unix and you lack sudo / admin rights, one simple way around it is to use the user scheme installation, basically run </p>
<p>"python setup.py install --user" from the command line in the folder of the module / library to be installed</p>
<p>(see <a href="http://docs.pytho... | 0 | 2012-07-25T15:25:17Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 11,662,181 | <p>well installing C compiler or GCC didn't work but I found a way to successfully install mysqldb package </p>
<p>kindly follow Mike schrieb's (Thanks to him) instructions <a href="http://www.velocityreviews.com/forums/t696557-how-to-install-setuptools-egg.html" rel="nofollow">here</a> . In my case, I used setuptools... | 1 | 2012-07-26T04:06:00Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 12,640,450 | <p>@main:</p>
<pre><code>$ su
$ yum install MySQL-python
</code></pre>
<p>and it will be installed (MySQLdb).</p>
| 5 | 2012-09-28T12:55:09Z | [
"python",
"mysql",
"installation"
] |
How to install MySQLdb package? (ImportError: No module named setuptools) | 1,449,130 | <p>I am trying to install MySQLdb package. I found the source code <a href="https://sourceforge.net/projects/mysql-python/files/">here</a>.</p>
<p>I did the following:</p>
<pre><code>gunzip MySQL-python-1.2.3c1.tar.gz
tar xvf MySQL-python-1.2.3c1.tar
cd MySQL-python-1.2.3c1
python setup.py build
</code></pre>
<p>As ... | 39 | 2009-09-19T18:07:44Z | 22,069,709 | <p>For Python 2.7, one can easily install using this </p>
<blockquote>
<p>apt-get install python2.7-mysqldb</p>
</blockquote>
| 2 | 2014-02-27T13:17:09Z | [
"python",
"mysql",
"installation"
] |
Simple object recognition | 1,449,139 | <p><strong>===SOLVED===</strong></p>
<p>Thanks for your suggestions and comments. By working on the flood_fill algorithm given in <a href="http://www.apress.com/book/view/9781430218432" rel="nofollow">Beginning Python Visualization</a> book (Chapter 9 - Image Processing) I have implemented what I have wanted. I can co... | 6 | 2009-09-19T18:11:29Z | 1,449,163 | <p><a href="http://opencv.willowgarage.com/wiki/PythonInterface" rel="nofollow">OpenCV</a> has a Python interface that you might find useful. </p>
| 2 | 2009-09-19T18:23:26Z | [
"python",
"image-processing",
"computer-vision",
"pattern-recognition"
] |
Simple object recognition | 1,449,139 | <p><strong>===SOLVED===</strong></p>
<p>Thanks for your suggestions and comments. By working on the flood_fill algorithm given in <a href="http://www.apress.com/book/view/9781430218432" rel="nofollow">Beginning Python Visualization</a> book (Chapter 9 - Image Processing) I have implemented what I have wanted. I can co... | 6 | 2009-09-19T18:11:29Z | 1,449,173 | <ol>
<li><p>Scan every square (e.g. from the top-left, left-to-right, top-to-bottom)</p></li>
<li><p>When you hit a blue square then:</p>
<p>a. Record this square as a location of a new object</p>
<p>b. Find all the other contiguous blue squares (e.g. by looking at the neighbours of this square, and the neighbours of... | 5 | 2009-09-19T18:29:19Z | [
"python",
"image-processing",
"computer-vision",
"pattern-recognition"
] |
Simple object recognition | 1,449,139 | <p><strong>===SOLVED===</strong></p>
<p>Thanks for your suggestions and comments. By working on the flood_fill algorithm given in <a href="http://www.apress.com/book/view/9781430218432" rel="nofollow">Beginning Python Visualization</a> book (Chapter 9 - Image Processing) I have implemented what I have wanted. I can co... | 6 | 2009-09-19T18:11:29Z | 1,449,176 | <p>Looking at the image you provided, all you need to do next is to apply a simple <a href="http://en.wikipedia.org/wiki/Region%5Fgrowing" rel="nofollow">region growing algorithm</a>. If I were using MATLAB, I would use <strong><a href="http://www.mathworks.com/access/helpdesk/help/toolbox/images/bwlabel.html" rel="nof... | 3 | 2009-09-19T18:31:15Z | [
"python",
"image-processing",
"computer-vision",
"pattern-recognition"
] |
Simple object recognition | 1,449,139 | <p><strong>===SOLVED===</strong></p>
<p>Thanks for your suggestions and comments. By working on the flood_fill algorithm given in <a href="http://www.apress.com/book/view/9781430218432" rel="nofollow">Beginning Python Visualization</a> book (Chapter 9 - Image Processing) I have implemented what I have wanted. I can co... | 6 | 2009-09-19T18:11:29Z | 1,451,137 | <p>I used to do this kind of analysis on micrographs and eventually put everything I needed into an image processing and analysis package written in C, driven via Tcl. (It worked with 512 x 512 images only, which explains why 512 crops up so often. There were images with pixels of various sizes allocated, but most of... | 3 | 2009-09-20T14:27:17Z | [
"python",
"image-processing",
"computer-vision",
"pattern-recognition"
] |
Simple object recognition | 1,449,139 | <p><strong>===SOLVED===</strong></p>
<p>Thanks for your suggestions and comments. By working on the flood_fill algorithm given in <a href="http://www.apress.com/book/view/9781430218432" rel="nofollow">Beginning Python Visualization</a> book (Chapter 9 - Image Processing) I have implemented what I have wanted. I can co... | 6 | 2009-09-19T18:11:29Z | 1,451,151 | <p><a href="http://en.wikipedia.org/wiki/Connected%5FComponent%5FLabeling" rel="nofollow">Connected component analysis</a> may be what you are looking for.</p>
| 2 | 2009-09-20T14:32:23Z | [
"python",
"image-processing",
"computer-vision",
"pattern-recognition"
] |
Google app engine and python and objects that pass by value | 1,449,257 | <p>This is really a python language question, but its wrapped around a Google appengine specific problem.</p>
<p>We have</p>
<pre>
class User( db.Model ) :
email = db.StringProperty()
name = db.StringProperty()
password = db.StringProperty()
# more fields..
</pre>
<p>Because the user account is accessed so ... | 2 | 2009-09-19T19:06:48Z | 1,449,305 | <p>I'm guessing: </p>
<p>Putting objects in the Session means that the objects is serialized ( pickled usually ) and stored somewhere (disk, memory, db). When it is retrieved from the Session, a <em>new</em> object is created from serialized the old state.</p>
<ul>
<li>In the first example each <code>self.session[ 'c... | 3 | 2009-09-19T19:30:13Z | [
"python",
"google-app-engine"
] |
Google app engine and python and objects that pass by value | 1,449,257 | <p>This is really a python language question, but its wrapped around a Google appengine specific problem.</p>
<p>We have</p>
<pre>
class User( db.Model ) :
email = db.StringProperty()
name = db.StringProperty()
password = db.StringProperty()
# more fields..
</pre>
<p>Because the user account is accessed so ... | 2 | 2009-09-19T19:06:48Z | 1,461,932 | <p>I'm the author of gaeutilities. I contacted Nick to talk about this, and he gave me some good ideas. I'll have a solution for this in the final 1.3 release.</p>
| 2 | 2009-09-22T18:51:53Z | [
"python",
"google-app-engine"
] |
Google app engine and python and objects that pass by value | 1,449,257 | <p>This is really a python language question, but its wrapped around a Google appengine specific problem.</p>
<p>We have</p>
<pre>
class User( db.Model ) :
email = db.StringProperty()
name = db.StringProperty()
password = db.StringProperty()
# more fields..
</pre>
<p>Because the user account is accessed so ... | 2 | 2009-09-19T19:06:48Z | 1,463,780 | <p>Sorry, I'm new to this site, and I don't see where to comment on an answer?</p>
<p>Anyway, I've fixed the specific issue that instigated the original post. While serialization of data is still suboptimal, happening on write, I have managed to make sure assigning model entities as items in a session will work as exp... | 1 | 2009-09-23T03:11:48Z | [
"python",
"google-app-engine"
] |
How to install setuptools? | 1,449,396 | <p>I'm trying to install setuptools. When I run "sh setuptools-0.6c9-py2.4.egg" I get the following message:</p>
<blockquote>
<p>Permission denied:
'/usr/lib/python2.4/site-packages/test-easy-install-26338.write-test'</p>
</blockquote>
<p>It is expectable, since I do not have root permissions on the system. Some ... | 5 | 2009-09-19T20:03:14Z | 1,449,437 | <p>Virtualenv comes with setuptools pre-installed, I believe. I know that it at least comes with <code>easy_install</code>. You should then be able to run:</p>
<pre><code>/home/myname/bin/easy_install setuptools
</code></pre>
<p>This should install the newest version of setuptools on your virtualenv.</p>
| 1 | 2009-09-19T20:26:12Z | [
"python",
"setuptools"
] |
How to install setuptools? | 1,449,396 | <p>I'm trying to install setuptools. When I run "sh setuptools-0.6c9-py2.4.egg" I get the following message:</p>
<blockquote>
<p>Permission denied:
'/usr/lib/python2.4/site-packages/test-easy-install-26338.write-test'</p>
</blockquote>
<p>It is expectable, since I do not have root permissions on the system. Some ... | 5 | 2009-09-19T20:03:14Z | 1,449,541 | <p>You have to activate your virtualenv first, else you just have a bunch of folders. Use the full path to the scripts in your virtual env's <code>bin</code> or do <code>source bin/activate</code></p>
| 1 | 2009-09-19T21:14:11Z | [
"python",
"setuptools"
] |
How to install setuptools? | 1,449,396 | <p>I'm trying to install setuptools. When I run "sh setuptools-0.6c9-py2.4.egg" I get the following message:</p>
<blockquote>
<p>Permission denied:
'/usr/lib/python2.4/site-packages/test-easy-install-26338.write-test'</p>
</blockquote>
<p>It is expectable, since I do not have root permissions on the system. Some ... | 5 | 2009-09-19T20:03:14Z | 1,452,826 | <p>Just adding extra detail to what already have been said.</p>
<ol>
<li>Download <code>tar.gz</code> of the latest version of <a href="http://pypi.python.org/pypi/virtualenv">virtualenv</a>.</li>
<li>Unpack it.</li>
<li>You don't even need to install it, just run <code>virtualenv.py</code>, for example:<br> <code>vir... | 8 | 2009-09-21T03:54:43Z | [
"python",
"setuptools"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 1,449,498 | <p>You don't need the executable for setuptools.
You can download the source code, unpack it, traverse to the downloaded directory and run <code>python setup.py install</code> in the command prompt</p>
| 20 | 2009-09-19T20:54:53Z | [
"python",
"pip"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 1,449,704 | <p><a href="http://web.archive.org/web/20120625104458/http://blog.sadphaeton.com/2009/01/20/python-development-windows-part-2-installing-easyinstallcould-be-easier.html">This</a> is a good tutorial on how to get <code>easy_install</code> on windows. The short answer: add <code>C:\Python26\Scripts</code> (or whatever py... | 51 | 2009-09-19T22:40:01Z | [
"python",
"pip"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 1,455,501 | <p>You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.</p>
| 0 | 2009-09-21T16:40:12Z | [
"python",
"pip"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 13,445,682 | <p>As I <a href="http://stackoverflow.com/questions/11453866/python-modules-names-vs-the-name-of-the-actual-package">wrote elsewhere</a></p>
<blockquote>
<p>Packaging in Python is dire. The root cause is that the language ships without a package manager. </p>
<p>Fortunately, there is one package manager for Pyt... | 11 | 2012-11-18T23:22:03Z | [
"python",
"pip"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 15,626,784 | <p>The <a href="http://stackoverflow.com/a/1449704/1438393">accepted answer</a> is outdated. So first, <a href="https://pypi.python.org/pypi/pip"><code>pip</code></a> is preferred over <code>easy_install</code>, (<a href="http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install">Why use pip over easy_in... | 121 | 2013-03-25T23:34:12Z | [
"python",
"pip"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 17,430,135 | <p>I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. <a href="http://cli.learncodethehardway.org/book/" rel="nofollow">This</a> can help you get started with it.</p>
<ul>
<li>Firstly, you'll need to add p... | 2 | 2013-07-02T15:53:04Z | [
"python",
"pip"
] |
How do I install Python packages on Windows? | 1,449,494 | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\s... | 89 | 2009-09-19T20:52:58Z | 23,833,666 | <p>Newer versions of Python for Windows come with the <em>pip</em> package manager. <a href="https://pip.pypa.io/en/latest/installing/">(source)</a></p>
<blockquote>
<p>pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4</p>
</blockquote>
<p>Use that to install packages:</p>
<pre><code>cd C... | 36 | 2014-05-23T15:56:04Z | [
"python",
"pip"
] |
How to convert an NSDictionary to a Python dict? | 1,449,620 | <p>I have a plugin written entirely in Python using PyObjC whose core classes I need to convert to Objective-C. One of them basically just loads up a Python module and executes a specific function, passing it keyword arguments. In PyObjC, this was extremely.</p>
<p>However, I'm having difficulty figuring out how to ... | 2 | 2009-09-19T21:47:03Z | 1,449,948 | <p>Oh, looks like I misunderstood your question. Well, going the other direction isn't terribly different. This should be (as least a start of) the function you're looking for (I haven't tested it thoroughly though, so beware of the bugs):</p>
<pre><code>// Returns a new reference
PyObject *ObjcToPyObject(id object)
{... | 2 | 2009-09-20T00:38:54Z | [
"python",
"objective-c",
"pyobjc"
] |
PIL not rendering fonts uniformly across machines | 1,449,663 | <p>I wrote some code that spits out an image. The code ran on my local machine yields this image:</p>
<p><img src="http://img32.yfrog.com/img32/9476/local.png" alt="local" title="" /></p>
<p>and on my webhost, it looks like this:</p>
<p><img src="http://img32.imageshack.us/img32/858/hoste.png" alt="host" title="" />... | 2 | 2009-09-19T22:14:29Z | 1,449,843 | <p>I would <em>guess</em> that the top image was rendered with the TrueType hinting bytecode VM enabled, where the bottom was using only FreeType's auto-hinting. (Personally I prefer the bottom!)</p>
<p>There are, unfortunately, <a href="http://freetype.org/patents.html" rel="nofollow">software patent</a> issues which... | 4 | 2009-09-19T23:54:51Z | [
"python",
"python-imaging-library"
] |
Converting 2.5 byte comparisons to 3 | 1,449,791 | <p>I'm trying to convert a 2.5 program to 3.</p>
<p>Is there a way in python 3 to change a byte string, such as b'\x01\x02' to a python 2.5 style string, such as '\x01\x02', so that string and byte-by-byte comparisons work similarly to 2.5? I'm reading the string from a binary file.</p>
<p>I have a 2.5 program that r... | 2 | 2009-09-19T23:32:17Z | 1,449,886 | <p>Bytes is an immutable sequence of integers (in the range 0<= to <256), therefore when you're accessing <code>(a+b)[0]</code> you're getting back an integer, exactly the same one you'd get by accessing <code>a[0]</code>. so when you're comparing sequence <code>a</code> to an integer <code>(a+b)[0]</code>, they'... | 3 | 2009-09-20T00:12:10Z | [
"python",
"python-3.x"
] |
Python TurtleGraphics - Making a randomly moving turtle? | 1,449,826 | <p>I'm trying to create a randomly moving turtle here by following these steps in a function I've called drunk_turtle():</p>
<p>Repeat the following as many times as you like:</p>
<ul>
<li>Randomly choose an integer, called rand_num, from -1 to 1 (i.e. randomly set rand_num to be -1, 0, or 1)</li>
<li>Make the turtle... | 0 | 2009-09-19T23:48:08Z | 1,449,866 | <p>You can find all of that information in <a href="http://docs.python.org/library/random.html" rel="nofollow">the Python random manual</a>.</p>
<blockquote>
<p><code>random.randint(a, b)</code></p>
<pre><code>Return a random integer N such that a <= N <= b.
</code></pre>
</blockquote>
<p>So you would do <co... | 1 | 2009-09-20T00:02:47Z | [
"python"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,449,945 | <p>The file <code>hooks/pre-commit</code> in your repository is a script or program which will be executed before a successful commit. Simply make this a script which updates your file with the proper version number as it is being committed (the revision number is passed to your script as it's run). Here's a tutorial... | 4 | 2009-09-20T00:38:10Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,449,949 | <p>Check out <a href="http://pysvn.tigris.org/" rel="nofollow">pysvn</a>. it exposes extensions in Python for Subversion runtime functionality.</p>
| 3 | 2009-09-20T00:39:00Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,449,950 | <p>There's a snippet of code in Django that allows you to do this, I'd recommend looking at it. <a href="http://code.djangoproject.com/browser/django/trunk/django/utils/version.py" rel="nofollow">http://code.djangoproject.com/browser/django/trunk/django/utils/version.py</a></p>
| 4 | 2009-09-20T00:39:21Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,450,760 | <p>I do this by simply running a small script when building my project. The script just calls svn info in combination with sed to get out the bare revision data and injects that number into the revision.txt file. </p>
<p>The Hudson build server makes it even easier as it sets the SVN revision number as an environment ... | 3 | 2009-09-20T10:46:38Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,454,120 | <p>I'm not sure about the Python specifics, but if put the string $Revision$ into your file somewhere and you have enable-auto-props=true in your SVN config, it'll get rewritten to something like $Revision: 144$. You could then parse this in your script.</p>
<p>There are <a href="http://svnbook.red-bean.com/en/1.1/ch... | 24 | 2009-09-21T11:43:56Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,458,623 | <p>I find the when it is run section slightly ambiguous - when it is run from where ? From an SVN checkout or from released code ? All the solutions work on injecting the SVN version somehow into the Python source or somewhere in the repository in a separate version file.</p>
<p>The version file is changed on fresh ch... | 1 | 2009-09-22T07:32:22Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 1,812,153 | <p>Similar to, but a little more pythonic than the PHP answer; put this in your module's <code>__init__.py</code>:</p>
<pre><code>__version__ = filter(str.isdigit, "$Revision: 13 $")
</code></pre>
<p>and make sure you add the Revision property:</p>
<pre><code>svn propset svn:keywords Revision __init__.py
</code></pr... | 13 | 2009-11-28T10:06:25Z | [
"python",
"svn",
"revision"
] |
Getting SVN revision number into a program automatically | 1,449,935 | <p>I have a python project under SVN, and I'm wanting to display the version number when it is run. Is there any way of doing this (such as automatically running a short script on commit which could update a version file, or querying an SVN repository in Python?)</p>
| 16 | 2009-09-20T00:33:45Z | 25,541,266 | <p>Or you can do like this:</p>
<pre><code>import re,subprocess
svn_info = subprocess.check_output("svn info")
print (re.search(ur"Revision:\s\d+", svn_info)).group()
</code></pre>
<p>it prints <code>"Revision: 2874"</code> in my project</p>
<p>Or like this:</p>
<pre><code>print (subprocess.check_output("svnversi... | 2 | 2014-08-28T05:22:27Z | [
"python",
"svn",
"revision"
] |
Python TurtleGraphics - Smoothing out random walks? | 1,449,990 | <p>I need some help with this question relating to TurtleGraphics in Python:</p>
<p>A small detail of tipsy_turtle() is that when the turtle turns 90 degrees it immediately "jumps" to the new direction. This makes its movement seem jagged. It might look better if the turtle moved smoothly when turning. So, for this qu... | 2 | 2009-09-20T01:03:37Z | 1,449,996 | <p>Hopefully this sample clears up what went wrong in your example -- you performed either <code>rand_num*90*rand_num*90</code> left turns, or <code>rand_num*90</code> right turns!</p>
<pre><code>if rand_num < 0: # don't need to multiply by 90 here - it's either +ve or -ve.
for step in xrange(90): # xrange is p... | 2 | 2009-09-20T01:12:53Z | [
"python"
] |
Python TurtleGraphics - Smoothing out random walks? | 1,449,990 | <p>I need some help with this question relating to TurtleGraphics in Python:</p>
<p>A small detail of tipsy_turtle() is that when the turtle turns 90 degrees it immediately "jumps" to the new direction. This makes its movement seem jagged. It might look better if the turtle moved smoothly when turning. So, for this qu... | 2 | 2009-09-20T01:03:37Z | 1,450,067 | <p>You might be able to do without the conditional for left-vs-right. I don't have python syntax down, so here's pseudocode</p>
<pre><code>turtle left randomly generated value 0 to 90
turtle right randomly generated value 0 to 90
turtle forward some amount
</code></pre>
<p>I.e., generate a random angle and turn left... | 0 | 2009-09-20T01:50:55Z | [
"python"
] |
Python TurtleGraphics - Smoothing out random walks? | 1,449,990 | <p>I need some help with this question relating to TurtleGraphics in Python:</p>
<p>A small detail of tipsy_turtle() is that when the turtle turns 90 degrees it immediately "jumps" to the new direction. This makes its movement seem jagged. It might look better if the turtle moved smoothly when turning. So, for this qu... | 2 | 2009-09-20T01:03:37Z | 1,450,351 | <p>I guess I'll venture an answer even though I am not completely sure what you want (see my comment to the question, and don't be surprised if I edit this answer as appropriate!).</p>
<p>Assuming you want the turtle to turn some number of degrees at each step, not necessarily 90, but not more than 90, then simply use... | 0 | 2009-09-20T05:17:56Z | [
"python"
] |
Is there any module that allows Django/Python to work with gnupg? | 1,450,036 | <p>I was wondering if there's any django module, or in such case any python module, that will allow me to create my own application to manage the creation, administration, etc of GnuPG keys, as well as the ability to sign and encrypt documents through this application?</p>
<p>If there's no such module, how can I do th... | 2 | 2009-09-20T01:33:22Z | 1,450,052 | <p><a href="http://py-gnupg.sourceforge.net/" rel="nofollow">GnuPGInterface</a> can <a href="http://sourceforge.net/docman/display%5Fdoc.php?docid=5499&group%5Fid=29555" rel="nofollow">do all of that</a> -- it's essentially a Python wrapper around the GnuPG program.</p>
<p><a href="http://pyme.sourceforge.net/" re... | 2 | 2009-09-20T01:40:03Z | [
"python",
"django",
"gnupg"
] |
Is there any module that allows Django/Python to work with gnupg? | 1,450,036 | <p>I was wondering if there's any django module, or in such case any python module, that will allow me to create my own application to manage the creation, administration, etc of GnuPG keys, as well as the ability to sign and encrypt documents through this application?</p>
<p>If there's no such module, how can I do th... | 2 | 2009-09-20T01:33:22Z | 1,987,745 | <p>I wrote a Django app <a href="http://code.google.com/p/django-email-extras/" rel="nofollow">django-email-extras</a> that does exactly what you're looking for. It lets users manage GPG keys via the Django admin and encrypts all mail to recipients with valid keys and includes support for multi-part templated emails wi... | 4 | 2010-01-01T02:38:57Z | [
"python",
"django",
"gnupg"
] |
Which queue is most appropriate? | 1,450,038 | <p>I'm building a mobile photo sharing site in Python similar to TwitPic and have been exploring various queues to handle the image processing. I've looked into RabbitMQ and ActiveMQ but I'm thinking that there is a better solution for my use case. I'm looking for something a little more lightweight. I'm open to any s... | 2 | 2009-09-20T01:33:24Z | 1,450,046 | <p>You could write a daemon that uses python's built-in <a href="http://docs.python.org/library/multiprocessing.html" rel="nofollow">multiprocessing</a> library and its <a href="http://docs.python.org/library/multiprocessing.html#multiprocessing.Queue" rel="nofollow">Queue</a>.</p>
<p>All you should have to do is set ... | 2 | 2009-09-20T01:38:18Z | [
"python",
"queue"
] |
Which queue is most appropriate? | 1,450,038 | <p>I'm building a mobile photo sharing site in Python similar to TwitPic and have been exploring various queues to handle the image processing. I've looked into RabbitMQ and ActiveMQ but I'm thinking that there is a better solution for my use case. I'm looking for something a little more lightweight. I'm open to any s... | 2 | 2009-09-20T01:33:24Z | 1,450,105 | <p>Are you considering single machine architecture, or a cluster of machines? Forwarding the image to an available worker process on the same machine or a different machine isn't profoundly different, particularly if you use TCP sockets. Knowing what workers are available, spawning more if necessary and the resources... | 0 | 2009-09-20T02:14:49Z | [
"python",
"queue"
] |
Which queue is most appropriate? | 1,450,038 | <p>I'm building a mobile photo sharing site in Python similar to TwitPic and have been exploring various queues to handle the image processing. I've looked into RabbitMQ and ActiveMQ but I'm thinking that there is a better solution for my use case. I'm looking for something a little more lightweight. I'm open to any s... | 2 | 2009-09-20T01:33:24Z | 1,450,118 | <p><a href="http://gearman.org/" rel="nofollow">Gearman</a> is good in that it optionally allows you to synchronize multiple jobs executed on multiple workers.</p>
<p>I've used <a href="http://xph.us/software/beanstalkd/" rel="nofollow">beanstalkd</a> successfully in a few high-volume applications.</p>
<p>The latter ... | 1 | 2009-09-20T02:24:21Z | [
"python",
"queue"
] |
Delete many elements of list (python) | 1,450,111 | <p>I have a list L.</p>
<p>I can delete element i by doing:</p>
<pre><code>del L[i]
</code></pre>
<p>But what if I have a set of non contiguous indexes to delete?</p>
<pre><code>I=set([i1, i2, i3,...])
</code></pre>
<p>Doing:</p>
<pre><code>for i in I:
del L[i]
</code></pre>
<p>Won't work.</p>
<p>Any idea... | 10 | 2009-09-20T02:18:34Z | 1,450,120 | <pre><code>for i in I:
del L[i]
</code></pre>
<p>won't work, because (depending on the order) you may invalidate the iterator -- this will usually show up as some items which you intended to delete remaining in the list.</p>
<p>It's always safe to delete items from the list in the reverse order of their indices. ... | 7 | 2009-09-20T02:25:05Z | [
"python",
"list"
] |
Delete many elements of list (python) | 1,450,111 | <p>I have a list L.</p>
<p>I can delete element i by doing:</p>
<pre><code>del L[i]
</code></pre>
<p>But what if I have a set of non contiguous indexes to delete?</p>
<pre><code>I=set([i1, i2, i3,...])
</code></pre>
<p>Doing:</p>
<pre><code>for i in I:
del L[i]
</code></pre>
<p>Won't work.</p>
<p>Any idea... | 10 | 2009-09-20T02:18:34Z | 1,450,175 | <blockquote>
<p>Eine Minuten bitte, Ich hap eine
kleine Problemo avec diese Religione.
-- Eddie Izzard (doing his impression
of Martin Luther)</p>
</blockquote>
<p>Deleting by reverse-iterating over a list to preserve the iterator <em>is</em> a common solution to this problem. But another solution is to cha... | 28 | 2009-09-20T03:04:55Z | [
"python",
"list"
] |
Delete many elements of list (python) | 1,450,111 | <p>I have a list L.</p>
<p>I can delete element i by doing:</p>
<pre><code>del L[i]
</code></pre>
<p>But what if I have a set of non contiguous indexes to delete?</p>
<pre><code>I=set([i1, i2, i3,...])
</code></pre>
<p>Doing:</p>
<pre><code>for i in I:
del L[i]
</code></pre>
<p>Won't work.</p>
<p>Any idea... | 10 | 2009-09-20T02:18:34Z | 1,455,447 | <p>If your original list data can safely be turned into a set (i.e. all unique values and doesn't need to maintain order), you could also use set operations:</p>
<pre><code>Lset = set(L)
newset = Lset.difference(I)
</code></pre>
<p>You could also maybe do something with a Bag/Multiset, though it probably isn't worth ... | 0 | 2009-09-21T16:28:16Z | [
"python",
"list"
] |
Delete many elements of list (python) | 1,450,111 | <p>I have a list L.</p>
<p>I can delete element i by doing:</p>
<pre><code>del L[i]
</code></pre>
<p>But what if I have a set of non contiguous indexes to delete?</p>
<pre><code>I=set([i1, i2, i3,...])
</code></pre>
<p>Doing:</p>
<pre><code>for i in I:
del L[i]
</code></pre>
<p>Won't work.</p>
<p>Any idea... | 10 | 2009-09-20T02:18:34Z | 23,283,296 | <pre><code>L = [ item for item in L if L.index(item) not in I ]
</code></pre>
| -1 | 2014-04-25T02:43:15Z | [
"python",
"list"
] |
Delete many elements of list (python) | 1,450,111 | <p>I have a list L.</p>
<p>I can delete element i by doing:</p>
<pre><code>del L[i]
</code></pre>
<p>But what if I have a set of non contiguous indexes to delete?</p>
<pre><code>I=set([i1, i2, i3,...])
</code></pre>
<p>Doing:</p>
<pre><code>for i in I:
del L[i]
</code></pre>
<p>Won't work.</p>
<p>Any idea... | 10 | 2009-09-20T02:18:34Z | 32,743,979 | <p>You can use <code>numpy.delete</code> as follows:</p>
<pre><code>import numpy as np
a = ['a', 'l', 3.14, 42, 'u']
I = [1, 3, 4]
np.delete(a, I).tolist()
# Returns: ['a', '3.14']
</code></pre>
<p>If you don't mind ending up with a <code>numpy</code> array at the end, you can leave out the <code>.tolist()</code>. Yo... | 3 | 2015-09-23T15:43:47Z | [
"python",
"list"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 1,450,142 | <p>You have to install a ProxyHandler</p>
<pre><code>urllib2.install_opener(
urllib2.build_opener(
urllib2.ProxyHandler({'http': '127.0.0.1'})
)
)
urllib2.urlopen('http://www.google.com')
</code></pre>
| 12 | 2009-09-20T02:34:39Z | [
"python",
"proxy",
"urllib2"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 1,450,154 | <pre><code>proxy = urllib2.ProxyHandler({'http': '127.0.0.1'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
urllib2.urlopen('http://www.google.com')
</code></pre>
| 107 | 2009-09-20T02:49:35Z | [
"python",
"proxy",
"urllib2"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 9,739,556 | <p>To use the default system proxies (e.g. from the http_support environment variable), the following works for the current request (without installing it into urllib2 globally):</p>
<pre><code>url = 'http://www.example.com/'
proxy = urllib2.ProxyHandler()
opener = urllib2.build_opener(proxy)
in_ = opener.open(url)
in... | 5 | 2012-03-16T14:55:23Z | [
"python",
"proxy",
"urllib2"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 19,843,346 | <p>You can set proxies using environment variables.</p>
<pre><code>import os
os.environ['http_proxy'] = '127.0.0.1'
os.environ['https_proxy'] = '127.0.0.1'
</code></pre>
<p><code>urllib2</code> will add proxy handlers automatically this way. You need to set proxies for different protocols separately otherwise they wi... | 6 | 2013-11-07T18:03:36Z | [
"python",
"proxy",
"urllib2"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 26,253,907 | <p>In Addition to the accepted answer:
My scipt gave me an error </p>
<pre><code>File "c:\Python23\lib\urllib2.py", line 580, in proxy_open
if '@' in host:
TypeError: iterable argument required
</code></pre>
<p>Solution was to add http:// in front of the proxy string:</p>
<pre><code>proxy = urllib2.ProxyHandler(... | 2 | 2014-10-08T09:48:21Z | [
"python",
"proxy",
"urllib2"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 36,835,088 | <p>In addition set the proxy for the command line session
Open a command line where you might want to run your script</p>
<pre><code>netsh winhttp set proxy YourProxySERVER:yourProxyPORT
</code></pre>
<p>run your script in that terminal.</p>
| 0 | 2016-04-25T08:09:21Z | [
"python",
"proxy",
"urllib2"
] |
Proxy with urllib2 | 1,450,132 | <p>I open urls with:</p>
<p><code>site = urllib2.urlopen('http://google.com')</code></p>
<p>And what I want to do is connect the same way with a proxy
I got somewhere telling me:</p>
<p><code>site = urllib2.urlopen('http://google.com', proxies={'http':'127.0.0.1'})</code></p>
<p>but that didn't work either.</p>
<p... | 56 | 2009-09-20T02:30:24Z | 38,168,940 | <p>One can also use requests if we would like to access a web page using proxies. Python 3 code: </p>
<pre><code>>>> import requests
>>> url = 'http://www.google.com'
>>> proxy = '169.50.87.252:80'
>>> requests.get(url, proxies={"http":proxy})
<Response [200]>
</code></pre>
<... | 1 | 2016-07-03T10:19:37Z | [
"python",
"proxy",
"urllib2"
] |
Change the focus from one Text widget to another | 1,450,180 | <p>I'm new to Python and I'm trying to create a simple GUI using Tkinter. </p>
<p>So often in many user interfaces, hitting the tab button will change the focus from one Text widget to another. Whenever I'm in a Text widget, tab only indents the text cursor.</p>
<p>Does anyone know if this is configurable? If not, ca... | 8 | 2009-09-20T03:06:06Z | 1,450,234 | <p>Due to the cross platform nature, the focus traversal is somewhat customizable, usually letting the X windows manager handle it (with focus follows mouse, or click). According to <a href="http://tcl.tk/man/tcl8.5/" rel="nofollow">the manual</a> it should be possible to <code>bind</code> an event to the key press eve... | -3 | 2009-09-20T03:31:41Z | [
"python",
"text",
"tabs",
"tkinter"
] |
Change the focus from one Text widget to another | 1,450,180 | <p>I'm new to Python and I'm trying to create a simple GUI using Tkinter. </p>
<p>So often in many user interfaces, hitting the tab button will change the focus from one Text widget to another. Whenever I'm in a Text widget, tab only indents the text cursor.</p>
<p>Does anyone know if this is configurable? If not, ca... | 8 | 2009-09-20T03:06:06Z | 1,450,779 | <p>Not sure about TKinter, but with PyQt, one can connect a function to the tab changed signal emitted by the tab box(the signal also carries an int value). But as far as I am aware Qt is pretty good at doing the right thing without it being specified.</p>
| 0 | 2009-09-20T10:57:52Z | [
"python",
"text",
"tabs",
"tkinter"
] |
Change the focus from one Text widget to another | 1,450,180 | <p>I'm new to Python and I'm trying to create a simple GUI using Tkinter. </p>
<p>So often in many user interfaces, hitting the tab button will change the focus from one Text widget to another. Whenever I'm in a Text widget, tab only indents the text cursor.</p>
<p>Does anyone know if this is configurable? If not, ca... | 8 | 2009-09-20T03:06:06Z | 1,451,343 | <p>This is very easy to do with Tkinter.</p>
<p>There are a couple of things that have to happen to make this work. First, you need to make sure that the standard behavior <i>doesn't</i> happen. That is, you don't want tab to both insert a tab and move focus to the next widget. By default events are processed by a spe... | 10 | 2009-09-20T15:57:10Z | [
"python",
"text",
"tabs",
"tkinter"
] |
Modifying locals in Python | 1,450,275 | <p>locals is a built in function that returns a dictionary of local values. The documentation says:</p>
<blockquote>
<p>Warning</p>
<p>The contents of this dictionary should
not be modified; changes may not
affect the values of local variables
used by the interpreter.</p>
</blockquote>
<p>Unfortunately, ... | 10 | 2009-09-20T04:03:29Z | 1,450,280 | <p>I'm not sure if it is subject to the same restrictions, but you can get a direct reference to the current frame (and from there, the local variables dictionary) through the inspect module:</p>
<pre><code>>>> import inspect
>>> inspect.currentframe().f_locals['foo'] = 'bar'
>>> dir()
['__b... | -1 | 2009-09-20T04:13:58Z | [
"python",
"locals"
] |
Modifying locals in Python | 1,450,275 | <p>locals is a built in function that returns a dictionary of local values. The documentation says:</p>
<blockquote>
<p>Warning</p>
<p>The contents of this dictionary should
not be modified; changes may not
affect the values of local variables
used by the interpreter.</p>
</blockquote>
<p>Unfortunately, ... | 10 | 2009-09-20T04:03:29Z | 1,450,304 | <p>This isn't possible. I think this is to allow for performance optimizations later on. Python bytecode references locals by index, not by name; if locals() was required to be writable, it could prevent interpreters from implementing some optimizations, or make them more difficult.</p>
<p>I'm fairly certain you're ... | 3 | 2009-09-20T04:37:28Z | [
"python",
"locals"
] |
Modifying locals in Python | 1,450,275 | <p>locals is a built in function that returns a dictionary of local values. The documentation says:</p>
<blockquote>
<p>Warning</p>
<p>The contents of this dictionary should
not be modified; changes may not
affect the values of local variables
used by the interpreter.</p>
</blockquote>
<p>Unfortunately, ... | 10 | 2009-09-20T04:03:29Z | 1,450,341 | <p>I just tested exec and it works in Python 2.6.2</p>
<pre><code>>>> def test():
... exec "a = 5"
... print a
...
>>> test()
5
</code></pre>
<p>If you are using Python 3.x, it does not work anymore because locals are optimized as an array at runtime, instead of using a dictionary.</p>
<p>W... | 11 | 2009-09-20T05:09:33Z | [
"python",
"locals"
] |
Modifying locals in Python | 1,450,275 | <p>locals is a built in function that returns a dictionary of local values. The documentation says:</p>
<blockquote>
<p>Warning</p>
<p>The contents of this dictionary should
not be modified; changes may not
affect the values of local variables
used by the interpreter.</p>
</blockquote>
<p>Unfortunately, ... | 10 | 2009-09-20T04:03:29Z | 1,450,858 | <p>The local variables are modified by assignment statements.</p>
<p>If you have dictionary keys which are strings, please don't also make them local variables -- just use them as dictionary keys.</p>
<p>If you absolutely <strong>must</strong> have local variables do this.</p>
<pre><code>def aFunction( a, b, c, d, ... | 5 | 2009-09-20T11:50:01Z | [
"python",
"locals"
] |
Django FormPreview - What is it for? | 1,450,295 | <p>While looking across the Django documentation, I came across the <a href="http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-preview/" rel="nofollow">FormPreview</a>. </p>
<p>The description says this:</p>
<blockquote>
<p>Django comes with an optional âform previewâ application that helps automa... | 2 | 2009-09-20T04:32:00Z | 1,450,313 | <p>I think they mean (I use django but I didn't know of this until now..) that you can let people write, for example in a textarea box like I'm doing right now. After the user submits it the system would preview it to the user and give him the chance to read and edit what he submitted, before it being submitted again a... | 2 | 2009-09-20T04:43:04Z | [
"python",
"django",
"forms"
] |
Django FormPreview - What is it for? | 1,450,295 | <p>While looking across the Django documentation, I came across the <a href="http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-preview/" rel="nofollow">FormPreview</a>. </p>
<p>The description says this:</p>
<blockquote>
<p>Django comes with an optional âform previewâ application that helps automa... | 2 | 2009-09-20T04:32:00Z | 1,450,413 | <p>To force a preview means the users are forced to see the value they have inserted on the form input fields, before django actually saves it to the database.</p>
<p>One example is <a href="http://docs.djangoproject.com/en/dev/ref/contrib/comments/" rel="nofollow">django comment system</a>, which enforce the users to... | 2 | 2009-09-20T06:10:01Z | [
"python",
"django",
"forms"
] |
How do you read from stdin in Python? | 1,450,393 | <p>I'm trying to do some of the <a href="http://en.wikipedia.org/wiki/Code_golf">code golf</a> challenges, but they all require the input to be taken from <code>stdin</code>. How do I get that in Python?</p>
| 854 | 2009-09-20T05:48:07Z | 1,450,396 | <p>Here's from <a href="http://oreilly.com/catalog/lpython/chapter/ch09.html#16308">Learning Python</a>:</p>
<pre><code>import sys
data = sys.stdin.readlines()
print "Counted", len(data), "lines."
</code></pre>
<p>On Unix, you could test it by doing something like:</p>
<pre><code>% cat countlines.py | python countli... | 117 | 2009-09-20T05:51:00Z | [
"python",
"stdin"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.