title
stringlengths
10
172
question_id
int64
469
40.1M
question_body
stringlengths
22
48.2k
question_score
int64
-44
5.52k
question_date
stringlengths
20
20
answer_id
int64
497
40.1M
answer_body
stringlengths
18
33.9k
answer_score
int64
-38
8.38k
answer_date
stringlengths
20
20
tags
list
How can I make this long_description and README differ by a couple of sentences?
2,134,941
<p>For a package of mine, I have a README.rst file that is read into the setup.py's long description like so:</p> <pre><code>readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( ... long_description = README_TEXT, .... ) </code></pre> <p>This way that I can have the READ...
6
2010-01-25T19:22:02Z
2,135,026
<p>You could always do this:</p> <pre><code>GITHUB_ALERT = 'This document reflects a pre-release version...' readme = open('README.rst', 'r') README_TEXT = readme.read().replace(GITHUB_ALERT, '') readme.close() setup( ... long_description = README_TEXT, .... ) </code></pre> <p>But then you'd have to ...
1
2010-01-25T19:34:35Z
[ "python", "github", "setuptools", "distutils", "pypi" ]
How can I make this long_description and README differ by a couple of sentences?
2,134,941
<p>For a package of mine, I have a README.rst file that is read into the setup.py's long description like so:</p> <pre><code>readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( ... long_description = README_TEXT, .... ) </code></pre> <p>This way that I can have the READ...
6
2010-01-25T19:22:02Z
2,135,816
<p>Another option is to side-step the issue completely by adding a paragraph that works in both environments: "The latest unstable code is on github. The latest stable kits are on pypi."</p> <p>After all, why assume that pypi people don't want to be pointed to github? This would be more helpful to both audiences, an...
5
2010-01-25T21:33:29Z
[ "python", "github", "setuptools", "distutils", "pypi" ]
How can I make this long_description and README differ by a couple of sentences?
2,134,941
<p>For a package of mine, I have a README.rst file that is read into the setup.py's long description like so:</p> <pre><code>readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( ... long_description = README_TEXT, .... ) </code></pre> <p>This way that I can have the READ...
6
2010-01-25T19:22:02Z
2,140,899
<p>You can just use a ReST comment with some text like "split here", and then split on that in your setup.py. Ian Bicking does that in virtualenv with <a href="http://bitbucket.org/ianb/virtualenv/src/77d301cdbf8c/docs/index.txt">index.txt</a> and <a href="http://bitbucket.org/ianb/virtualenv/src/tip/setup.py">setup.py...
7
2010-01-26T16:41:32Z
[ "python", "github", "setuptools", "distutils", "pypi" ]
Alpha masks with OpenGL
2,134,970
<p>I want to use an alpha mask in OpenGL so that white(1)=visible and black(0)=hidden.</p> <p>So what I do is I write something in the alpha component of the framebuffer using <code>glColorMask(False, False, False, True)</code> (I'm using python, you see) and then draw some geometry above it using blending.</p> <p>Bu...
5
2010-01-25T19:26:35Z
2,137,140
<p>Use glAlphaFunc( GL_GREATER, 0.5 );</p>
0
2010-01-26T02:14:28Z
[ "python", "opengl", "alpha", "blending" ]
Alpha masks with OpenGL
2,134,970
<p>I want to use an alpha mask in OpenGL so that white(1)=visible and black(0)=hidden.</p> <p>So what I do is I write something in the alpha component of the framebuffer using <code>glColorMask(False, False, False, True)</code> (I'm using python, you see) and then draw some geometry above it using blending.</p> <p>Bu...
5
2010-01-25T19:26:35Z
2,150,115
<p>Try asking for an <a href="http://www.opengl.org/resources/faq/technical/transparency.htm#blen0050" rel="nofollow">alpha buffer</a> when you create your GL context, if you aren't already.</p>
3
2010-01-27T20:44:58Z
[ "python", "opengl", "alpha", "blending" ]
Python,multi-threads,fetch webpages,download webpages
2,135,047
<p>I want to batch dowload webpages in one site. There are 5000000 urls links in my 'urls.txt' file. It's about 300M. How make a multi-threads link these urls and dowload these webpages? or How batch dowload these webpages?</p> <p>my ideas:</p> <pre><code>with open('urls.txt','r') as f: for el in f: ##fet...
5
2010-01-25T19:37:43Z
2,135,119
<p>Definitely downloading 5M web pages in one go is not a good idea, because you'll max out a lot of things, including your network bandwidth and your OS's file descriptors. I'd go in batches of 100-1000. You can use urllib.urlopen to get a socket and then just read() on several threads. You may be able to use select.s...
1
2010-01-25T19:49:11Z
[ "python", "web-scraping", "twisted" ]
Python,multi-threads,fetch webpages,download webpages
2,135,047
<p>I want to batch dowload webpages in one site. There are 5000000 urls links in my 'urls.txt' file. It's about 300M. How make a multi-threads link these urls and dowload these webpages? or How batch dowload these webpages?</p> <p>my ideas:</p> <pre><code>with open('urls.txt','r') as f: for el in f: ##fet...
5
2010-01-25T19:37:43Z
2,135,545
<p>If this isn't part of a larger program, then notnoop's idea of using some existing tool to accomplish this is a pretty good one. If a shell loop invoking wget solves your problem, that'll be a lot easier than anything involving more custom software development.</p> <p>However, if you need to fetch these resources ...
3
2010-01-25T20:53:03Z
[ "python", "web-scraping", "twisted" ]
Python,multi-threads,fetch webpages,download webpages
2,135,047
<p>I want to batch dowload webpages in one site. There are 5000000 urls links in my 'urls.txt' file. It's about 300M. How make a multi-threads link these urls and dowload these webpages? or How batch dowload these webpages?</p> <p>my ideas:</p> <pre><code>with open('urls.txt','r') as f: for el in f: ##fet...
5
2010-01-25T19:37:43Z
2,137,260
<p>First parse your file and push the urls into a queue then spawn 5-10 worker threads to pull urls out of the queue and download. Queue's are your friend with this.</p>
1
2010-01-26T02:59:09Z
[ "python", "web-scraping", "twisted" ]
Python,multi-threads,fetch webpages,download webpages
2,135,047
<p>I want to batch dowload webpages in one site. There are 5000000 urls links in my 'urls.txt' file. It's about 300M. How make a multi-threads link these urls and dowload these webpages? or How batch dowload these webpages?</p> <p>my ideas:</p> <pre><code>with open('urls.txt','r') as f: for el in f: ##fet...
5
2010-01-25T19:37:43Z
2,137,338
<p>A wget script is probably simplest, but if you're looking for a python-twisted crawling solution, check out <a href="http://scrapy.org/" rel="nofollow">scrapy</a></p>
0
2010-01-26T03:18:53Z
[ "python", "web-scraping", "twisted" ]
Writing Pythons Errors to a txt file
2,135,174
<p>I am having trouble getting this to work correctly (obviously) - I am ALMOST there, and I have a good idea of WHY it is not working - just not sure how to make it work. </p> <p>This is suppose to attempt to read a file into memory, if it fails it goes to the "except" clause of the block of code (that part is 'duh'...
1
2010-01-25T19:58:01Z
2,135,208
<p>the problem is here:</p> <pre><code> myStdError = str(sys.stderr) myFileErr.write(myStdError) </code></pre> <p>sys.stderr is a file-like interface defined in POSIX standards, called <a href="http://en.wikipedia.org/wiki/Standard_streams#Standard_error_.28stderr.29" rel="nofollow">standard error</a>, not "error te...
3
2010-01-25T20:01:59Z
[ "python", "error-handling" ]
Writing Pythons Errors to a txt file
2,135,174
<p>I am having trouble getting this to work correctly (obviously) - I am ALMOST there, and I have a good idea of WHY it is not working - just not sure how to make it work. </p> <p>This is suppose to attempt to read a file into memory, if it fails it goes to the "except" clause of the block of code (that part is 'duh'...
1
2010-01-25T19:58:01Z
2,135,231
<p>First, you should use a logging library. It will help you deal with different logging levels (info/warn/error), timestamps and more.</p> <p><a href="http://docs.python.org/library/logging.html" rel="nofollow">http://docs.python.org/library/logging.html</a></p> <p>Second, you need to catch the error, and then you c...
7
2010-01-25T20:05:40Z
[ "python", "error-handling" ]
Writing Pythons Errors to a txt file
2,135,174
<p>I am having trouble getting this to work correctly (obviously) - I am ALMOST there, and I have a good idea of WHY it is not working - just not sure how to make it work. </p> <p>This is suppose to attempt to read a file into memory, if it fails it goes to the "except" clause of the block of code (that part is 'duh'...
1
2010-01-25T19:58:01Z
2,135,257
<p>Like Kimvais says, your problem is:</p> <pre><code>myStdError = str(sys.stderr) myFileErr.write(myStdError) </code></pre> <p>sys.stderr is a file handle to stderr (stdout is what print writes to).</p> <p>You should do something like:</p> <pre><code>try: ...open file... except IOError as (errno, strerror): ...
0
2010-01-25T20:09:58Z
[ "python", "error-handling" ]
Writing Pythons Errors to a txt file
2,135,174
<p>I am having trouble getting this to work correctly (obviously) - I am ALMOST there, and I have a good idea of WHY it is not working - just not sure how to make it work. </p> <p>This is suppose to attempt to read a file into memory, if it fails it goes to the "except" clause of the block of code (that part is 'duh'...
1
2010-01-25T19:58:01Z
2,135,260
<p>Use the logging module. The logging module have exception formatters that will help you print exceptions in a pretty way.</p> <p><a href="http://docs.python.org/library/logging.html" rel="nofollow">http://docs.python.org/library/logging.html</a></p>
1
2010-01-25T20:11:48Z
[ "python", "error-handling" ]
Run python module in C#?
2,135,181
<p>Hey, I've been banging my head for the past two days trying to find out if it's possible to run a python module in C#. The module I'm interested in is Sympy which can be found here <a href="http://code.google.com/p/sympy/" rel="nofollow">http://code.google.com/p/sympy/</a> (in case anyone's interested). It's a math ...
2
2010-01-25T19:58:42Z
2,135,214
<p>I don't know how well loading a python lib in c# will do ya, but I'd write my program via IronPython.</p> <p>you can then compile it to an exe so your users don't know the difference.</p> <p>now this is guesswork, but maybe you can then load your assembly in other c# projects and use it that way. i.e. wrap the pyt...
2
2010-01-25T20:02:55Z
[ "c#", "python", "module" ]
What is the difference between a Zope utility defined with a factory versus a component?
2,135,316
<p>It's a little confusing that ZCML registrations for Zope utilities can accept a component or a factory.</p> <p><code>&lt;utility component=".some.Class" /&gt;</code></p> <p>versus</p> <p><code>&lt;utility factory=".some.Factory" /&gt;</code></p> <p>What is the difference?</p>
1
2010-01-25T20:18:16Z
2,135,406
<p>A factory <em>creates</em> utilities, while a utility registered as a component is an instance. Hence, if you look up a utility registered as a component, you will get the same object back every time. But if it's registered as a factory, you'll get a new instance every time.</p>
2
2010-01-25T20:31:34Z
[ "python", "zope", "zcml", "zope.component" ]
What is the difference between a Zope utility defined with a factory versus a component?
2,135,316
<p>It's a little confusing that ZCML registrations for Zope utilities can accept a component or a factory.</p> <p><code>&lt;utility component=".some.Class" /&gt;</code></p> <p>versus</p> <p><code>&lt;utility factory=".some.Factory" /&gt;</code></p> <p>What is the difference?</p>
1
2010-01-25T20:18:16Z
19,381,765
<p>I think @lennart-regebro's answer might be a little unintentionally deceptive. It's understandable as the zope docs are a little vague. I think below is the correct interpretation but I had to test it myself to be sure.</p> <p>In <strong>both the component and the factory</strong> registration <strong>each subseque...
2
2013-10-15T12:53:40Z
[ "python", "zope", "zcml", "zope.component" ]
Using LaTeX Beamer to display code
2,135,339
<p>I'm using the following LaTeX code in a Beamer presentation:</p> <pre><code>\begin{frame} \begin{figure} \centering \tiny \lstset{language=python} \lstinputlisting{code/get_extent.py} \end{figure} \end{frame} </code></pre> <p>Is it possible to select specific lines from my get_extent.py fi...
5
2010-01-25T20:20:50Z
2,135,475
<p>This has nothing to do with <code>beamer</code>; it's about a <code>listings</code> feature. Its excellent <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf" rel="nofollow">manual</a> has more. For example:</p> <pre><code>\lstinputlisting[firstline=2,lastline=5]{code/get_extent.py}...
9
2010-01-25T20:41:47Z
[ "python", "latex", "beamer" ]
python: processing a 16-element list into an 8-element list
2,135,454
<p>I have a list of 16 elements [a00,a01,a02,...,a15] and would like to compute a list [b0,b1,b2,b3,b4,b5,b6,b7] where </p> <pre><code>b0 = a00*256+a01 b1 = a02*256+a03 b2 = a04*256+a05 (etc.) </code></pre> <p>what's the easiest way of doing this? (I'm a beginner in python)</p>
1
2010-01-25T20:38:43Z
2,135,485
<p><code>b_list = [a_list[2*i] * 256 + a_list[2*i+1] for i in range(8)]</code></p> <p>Note that this only works if a has 16 elements.</p> <p>A more general solution would be:</p> <p><code>b_list = [a_list[2*i] * 256 + a_list[2*i+1] for i in range(len(a_list) / 2)]</code></p> <p>as long as <code>a_list</code> has an...
4
2010-01-25T20:42:55Z
[ "python", "list" ]
python: processing a 16-element list into an 8-element list
2,135,454
<p>I have a list of 16 elements [a00,a01,a02,...,a15] and would like to compute a list [b0,b1,b2,b3,b4,b5,b6,b7] where </p> <pre><code>b0 = a00*256+a01 b1 = a02*256+a03 b2 = a04*256+a05 (etc.) </code></pre> <p>what's the easiest way of doing this? (I'm a beginner in python)</p>
1
2010-01-25T20:38:43Z
2,135,492
<p>The first thing that comes to mind:</p> <pre><code>&gt;&gt;&gt; a=range(16) &gt;&gt;&gt; b=[a[i]*256+a[i+1] for i in range(0,len(a),+2)] [1, 515, 1029, 1543, 2057, 2571, 3085, 3599] </code></pre>
1
2010-01-25T20:45:06Z
[ "python", "list" ]
python: processing a 16-element list into an 8-element list
2,135,454
<p>I have a list of 16 elements [a00,a01,a02,...,a15] and would like to compute a list [b0,b1,b2,b3,b4,b5,b6,b7] where </p> <pre><code>b0 = a00*256+a01 b1 = a02*256+a03 b2 = a04*256+a05 (etc.) </code></pre> <p>what's the easiest way of doing this? (I'm a beginner in python)</p>
1
2010-01-25T20:38:43Z
2,135,502
<p>You can make a comprehension list...</p> <pre><code>a = [a00, a01,.... ] #Readed, take a list with 0,2,4... len(a) [15, will stop at 14] # then make a[i]*256 + a[i+1], so # a[0]*256+a[1], a[2]*256+a[3], ... a[14]*256+a[15] b = [ a[i]*256+a[i+1] for i in range(0,len(a),2) ] </code></pre>
2
2010-01-25T20:47:04Z
[ "python", "list" ]
python: processing a 16-element list into an 8-element list
2,135,454
<p>I have a list of 16 elements [a00,a01,a02,...,a15] and would like to compute a list [b0,b1,b2,b3,b4,b5,b6,b7] where </p> <pre><code>b0 = a00*256+a01 b1 = a02*256+a03 b2 = a04*256+a05 (etc.) </code></pre> <p>what's the easiest way of doing this? (I'm a beginner in python)</p>
1
2010-01-25T20:38:43Z
2,135,569
<pre><code>lst = [a01, a02, ... ] result = [256 * a + b for a, b in zip(lst[::2], lst[1::2])] </code></pre> <p>This avoids the unpythonic use of <code>range</code>.</p>
2
2010-01-25T20:57:10Z
[ "python", "list" ]
python: processing a 16-element list into an 8-element list
2,135,454
<p>I have a list of 16 elements [a00,a01,a02,...,a15] and would like to compute a list [b0,b1,b2,b3,b4,b5,b6,b7] where </p> <pre><code>b0 = a00*256+a01 b1 = a02*256+a03 b2 = a04*256+a05 (etc.) </code></pre> <p>what's the easiest way of doing this? (I'm a beginner in python)</p>
1
2010-01-25T20:38:43Z
2,135,578
<p>Not to get too golfy, but if you'd like to avoid subscript hell, you can use this handy <code>zip</code> idiom:</p> <pre><code>a = range(16) b = [x*256+y for x,y in zip(*[iter(a)]*2)] </code></pre>
4
2010-01-25T20:58:11Z
[ "python", "list" ]
How to write a wrapper over functions and member functions that executes some code before and after the wrapped function?
2,135,457
<p>I'm trying to write some wrapper class or function that allows me to execute some code before and after the wrapped function.</p> <pre><code>float foo(int x, float y) { return x * y; } BOOST_PYTHON_MODULE(test) { boost::python::def("foo", &lt;somehow wrap "&amp;foo"&gt;); } </code></pre> <p>Ideally, the ...
7
2010-01-25T20:39:08Z
2,136,031
<p>Have you looked at the function wrapping technique described by Stroustrup in his "<a href="http://public.research.att.com/~bs/wrapper.pdf" rel="nofollow">Wrapping C++ Member Function Calls</a>" paper? There's also a SO response <a href="http://stackoverflow.com/questions/879408/c-function-wrapper-that-behaves-just...
0
2010-01-25T22:09:11Z
[ "c++", "python", "binding", "wrapper", "boost-python" ]
How to write a wrapper over functions and member functions that executes some code before and after the wrapped function?
2,135,457
<p>I'm trying to write some wrapper class or function that allows me to execute some code before and after the wrapped function.</p> <pre><code>float foo(int x, float y) { return x * y; } BOOST_PYTHON_MODULE(test) { boost::python::def("foo", &lt;somehow wrap "&amp;foo"&gt;); } </code></pre> <p>Ideally, the ...
7
2010-01-25T20:39:08Z
2,140,112
<p>In this case, you can write a Functor class that wraps over your function, and then overload boost::python::detail::get_signature to accept your Functor!</p> <p>UPDATE: Added support for member functions too!</p> <p>Example:</p> <pre><code>#include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/python.hpp&gt; #i...
11
2010-01-26T14:49:10Z
[ "c++", "python", "binding", "wrapper", "boost-python" ]
Creating a socket restricted to localhost connections only
2,135,595
<p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in P...
8
2010-01-25T21:00:44Z
2,135,628
<p>If you do sock.bind((port,'127.0.0.1')) it will only listen on localhost, and not on other interfaces, so that's all you need.</p>
0
2010-01-25T21:06:33Z
[ "python", "client-server" ]
Creating a socket restricted to localhost connections only
2,135,595
<p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in P...
8
2010-01-25T21:00:44Z
2,135,631
<p>Given a socket created with <code>socket.socket()</code>, you can use <a href="http://docs.python.org/library/socket.html#socket.socket.bind"><code>bind()</code></a> before listening:</p> <pre><code>socket.bind(('127.0.0.1', 80)) </code></pre> <p>Using the address <code>127.0.0.1</code> indicates that the socket s...
6
2010-01-25T21:07:43Z
[ "python", "client-server" ]
Creating a socket restricted to localhost connections only
2,135,595
<p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in P...
8
2010-01-25T21:00:44Z
2,135,637
<p><a href="http://www.amk.ca/python/howto/sockets/" rel="nofollow">http://www.amk.ca/python/howto/sockets/</a></p> <p>Shows some socket example. This tidbit is interesting to you I think</p> <blockquote> <p>we used socket.gethostname() so that the socket would be visible to the outside world. If we had used s.bind...
5
2010-01-25T21:08:24Z
[ "python", "client-server" ]
Creating a socket restricted to localhost connections only
2,135,595
<p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in P...
8
2010-01-25T21:00:44Z
2,135,720
<p>You might want to use the <a href="http://docs.python.org/library/queue.html" rel="nofollow">queue module</a> from the standard library instead. It's designed specifically to facilitate communication between threads. A quote from the docs:</p> <blockquote> <p>The Queue module implements multi-producer, multi-cons...
2
2010-01-25T21:20:04Z
[ "python", "client-server" ]
Creating a socket restricted to localhost connections only
2,135,595
<p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in P...
8
2010-01-25T21:00:44Z
2,135,752
<p>If you are running on a UNIX-based system, you might want to consider using <a href="http://en.wikipedia.org/wiki/Unix_socket" rel="nofollow">UNIX Domain Sockets</a> instead of Internet sockets. I think something like the following should work:</p> <pre><code>&gt;&gt;&gt; # in one window/shell &gt;&gt;&gt; import ...
3
2010-01-25T21:24:18Z
[ "python", "client-server" ]
Creating a socket restricted to localhost connections only
2,135,595
<p>I have a python program with many threads. I was thinking of creating a socket, bind it to localhost, and have the threads read/write to this central location. However I do not want this socket open to the rest of the network, just connections from <code>127.0.0.1</code> should be accepted. How would I do this (in P...
8
2010-01-25T21:00:44Z
2,135,937
<p>notionOn TCP/IP networks 127.0.0.0/8 is a non-routeable network, so you should not be able to send an IP datagram destined to 127.0.0.1 across a routed infrastructure. The router will just discard the datagram. However, it is possible to construct and send datagrams with a destination address of 127.0.0.1, so a host...
0
2010-01-25T21:53:21Z
[ "python", "client-server" ]
(python) sgmlparser and how to extract data between tags, not attributes/values
2,135,964
<p>Every example I see for sgmlparser involves finding a tag, then finding the attributes/values of the tag. So for it would be the ability to extract 'google.com' out. but i want the data between tags. so if i used sgmlparser, i would look for and extract out everything in that div until it's closing tag. is that t...
3
2010-01-25T21:58:10Z
2,138,168
<p>Because you mention div's, I gather you want to parse HTML. For doing that your best choice is <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">BeautifulSoup</a>.</p>
1
2010-01-26T08:17:03Z
[ "python", "html" ]
Enumerate a DateRange
2,136,151
<p>I have 2 dates and I am trying to build labels of an x-axis of a plot. </p> <p>As such, I need a way to take 2 <strong>datetime</strong> objects, i.e <strong>2009-10-12 00:00:00</strong> and <strong>2009-10-20 00:00:00</strong> and generate a list like so:</p> <pre><code>["2009-10-12", "2009-10-13", "2009-10-14", ...
3
2010-01-25T22:27:24Z
2,136,181
<pre><code>import datetime first=datetime.date(2009,10,12) last=datetime.date(2009,10,20) adate=first dates=[] while adate&lt;=last: dates.append(adate) adate+=datetime.timedelta(1) print(dates) </code></pre> <p>Or, for lovers of list comprehension:</p> <pre><code>len=(last-first).days dates=[first+datetime....
3
2010-01-25T22:31:41Z
[ "python", "datetime" ]
Enumerate a DateRange
2,136,151
<p>I have 2 dates and I am trying to build labels of an x-axis of a plot. </p> <p>As such, I need a way to take 2 <strong>datetime</strong> objects, i.e <strong>2009-10-12 00:00:00</strong> and <strong>2009-10-20 00:00:00</strong> and generate a list like so:</p> <pre><code>["2009-10-12", "2009-10-13", "2009-10-14", ...
3
2010-01-25T22:27:24Z
2,136,204
<pre><code>from datetime import date, timedelta a, b = date(1010, 10, 12), date(1010, 10, 20) times = [a + timedelta(x) for x in xrange((b-a).days)] # If you want to format them: times = [x.strftime('%Y-%m-%d') for x in times] </code></pre>
0
2010-01-25T22:35:21Z
[ "python", "datetime" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
2,136,323
<p>You should post your example document, because the code works fine:</p> <pre><code>&gt;&gt;&gt; import BeautifulSoup &gt;&gt;&gt; soup = BeautifulSoup.BeautifulSoup('&lt;html&gt;&lt;body&gt;&lt;div id="articlebody"&gt; ... &lt;/div&gt;&lt;/body&gt;&lt;/html') &gt;&gt;&gt; soup.find("div", {"id": "articlebody"}) &lt...
78
2010-01-25T22:55:30Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
2,136,354
<p>have you tried <code>soup.findAll("div", {"id": "articlebody"})</code>?</p> <p>sounds crazy, but if you're scraping stuff from the wild, you can't rule out multiple divs...</p>
2
2010-01-25T23:00:55Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
2,136,366
<p>I used:</p> <pre><code>soup.findAll('tag', attrs={'attrname':"attrvalue"}) </code></pre> <p>As my syntax for find/findall; that said, unless there are other optional parameters between the tag and attribute list, this shouldn't be different.</p>
2
2010-01-25T23:02:37Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
2,136,368
<p>Here is a code fragment </p> <pre><code>soup = BeautifulSoup(:"index.html") titleList = soup.findAll('title') divList = soup.findAll('div', attrs={ "class" : "article story"}) </code></pre> <p>As you can see I find all tags and then I find all tags with class="article" inside</p>
1
2010-01-25T23:03:03Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
2,136,391
<p>In the beautifulsoup source this line allows divs to be nested within divs; so your concern in lukas' comment wouldn't be valid.</p> <pre><code>NESTABLE_BLOCK_TAGS = ['blockquote', 'div', 'fieldset', 'ins', 'del'] </code></pre> <p>What I think you need to do is to specify the attrs you want such as</p> <pre><code...
5
2010-01-25T23:05:25Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
2,376,703
<p>I think there is a problem when the 'div' tags are too much nested. I am trying to parse some contacts from a facebook html file, and the Beautifulsoup is not able to find tags "div" with class "fcontent".</p> <p>This happens with other classes as well. When I search for divs in general, it turns only those that ar...
9
2010-03-04T03:34:24Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
14,587,348
<p>Most probably because of the default beautifulsoup parser has problem. Change a different parser, like 'lxml' and try again.</p>
6
2013-01-29T16:20:48Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
22,410,466
<p>To find an element by its <code>id</code>:</p> <pre><code>div = soup.find(id="articlebody") </code></pre>
20
2014-03-14T16:17:10Z
[ "python", "beautifulsoup" ]
Beautiful Soup and extracting a div and its contents by ID
2,136,267
<pre><code>soup.find("tagName", { "id" : "articlebody" }) </code></pre> <p>Why does this NOT return the <code>&lt;div id="articlebody"&gt; ... &lt;/div&gt;</code> tags and stuff in between? It returns nothing. And I know for a fact it exists because I'm staring right at it from </p> <pre><code>soup.prettify() </code>...
56
2010-01-25T22:46:05Z
29,959,746
<p>Happened to me also while trying to scrape Google.<br> I ended up using pyquery.<br> Install:</p> <pre><code>pip install pyquery </code></pre> <p>Use:</p> <pre><code>from pyquery import PyQuery pq = PyQuery('&lt;html&gt;&lt;body&gt;&lt;div id="articlebody"&gt; ... &lt;/div&gt;&lt;/body&gt;&lt;/html') tag = pq...
3
2015-04-30T05:34:56Z
[ "python", "beautifulsoup" ]
Using multiple modules/types with Python C API?
2,136,337
<p>I've got two different Python extension modules; let's call them A and B. Module A contains a storage class type called container that I want to use within Module B as the return type of a class method. </p> <p>I can't seem to find any documentation on how I'm supposed to do this. I roughly followed this article...
3
2010-01-25T22:57:37Z
2,136,670
<p>Your problem is that <code>type-&gt;tp_init</code> doesn't do what you want. <code>type-&gt;tp_init</code> is called after an object is allocated to do the instantiation. You'd first have to allocate the object using <code>type-&gt;tp_new</code>, then pass that object as the first argument to <code>type-&gt;tp_init<...
3
2010-01-26T00:06:04Z
[ "python", "c", "binding", "python-c-api", "python-extensions" ]
Matching one-line JavaScript comments (//) with re
2,136,363
<p>I'd like to filter out (mostly one-line) comments from (mostly valid) JavaScript using python's <code>re</code> module. For example:</p> <pre><code>// this is a comment var x = 2 // and this is a comment too var url = "http://www.google.com/" // and "this" too url += 'but // this is not a comment' // however this o...
6
2010-01-25T23:01:59Z
2,136,633
<p>It might be easier to parse if you had explicit semi-colons. </p> <p>In any case, this works: </p> <pre><code>import re rx = re.compile(r'.*(//(.*))$') lines = ["// this is a comment", "var x = 2 // and this is a comment too", """var url = "http://www.google.com/" // and "this" too""", """url += 'bu...
1
2010-01-25T23:57:33Z
[ "javascript", "python", "regex", "replace" ]
Matching one-line JavaScript comments (//) with re
2,136,363
<p>I'd like to filter out (mostly one-line) comments from (mostly valid) JavaScript using python's <code>re</code> module. For example:</p> <pre><code>// this is a comment var x = 2 // and this is a comment too var url = "http://www.google.com/" // and "this" too url += 'but // this is not a comment' // however this o...
6
2010-01-25T23:01:59Z
2,137,351
<p>My regex powers had gone a bit stale so I've used your question to fresh what I remember. It became a fairly large regex mostly because I also wanted to filter multi-line comments.</p> <pre><code>import re reexpr = r""" ( # Capture code "(?:\\.|[^"\\])*" # String literal...
7
2010-01-26T03:23:19Z
[ "javascript", "python", "regex", "replace" ]
Dynamic Django model creation based on existing DB table
2,136,371
<p>I'm trying to figure out how I can use the type() module to dynamically create a Django model based on existing DB tables without having to either write it out manually or use the manage.py generator to inspect the DB. Reason is my schema changes frequently -- adding new tables, adding/deleting columns, etc. Anyon...
3
2010-01-25T23:03:23Z
2,136,423
<p>You can look at <a href="http://code.djangoproject.com/browser/django/trunk/django/core/management/commands/inspectdb.py" rel="nofollow">inspectdb code</a>, and instead of outputting code return classes.</p>
1
2010-01-25T23:13:13Z
[ "python", "django", "django-models" ]
Python web frontend, retaining interpreter state
2,136,457
<p>I have a python script that parses a large set of data into an internal memory structure, and implements various fetch functions on the structure.</p> <p>I want to built a simple web frontend for this script, with the condition that the data is only initialized/loaded once (since re-loading upon each fetch would co...
0
2010-01-25T23:21:27Z
2,136,472
<p>I have implemented a solution to a very similar problem. My solution was to use an xmlrpc server, specifically </p> <pre><code>twisted.web.xmlrpc </code></pre> <p>I have a method that allows for injection of new data, and have methods for retrieving the data. </p>
1
2010-01-25T23:24:20Z
[ "php", "python" ]
Python web frontend, retaining interpreter state
2,136,457
<p>I have a python script that parses a large set of data into an internal memory structure, and implements various fetch functions on the structure.</p> <p>I want to built a simple web frontend for this script, with the condition that the data is only initialized/loaded once (since re-loading upon each fetch would co...
0
2010-01-25T23:21:27Z
2,136,705
<p>Use a persistent server like <a href="http://www.cherrypy.org/" rel="nofollow">CherryPy</a> or <a href="http://twistedmatrix.com/trac/wiki/WebDevelopmentWithTwisted" rel="nofollow">Twisted Web</a>. All requests will be served by the same process.</p>
0
2010-01-26T00:11:58Z
[ "php", "python" ]
In Python, how do I split a string and keep the separators?
2,136,556
<p>Here's the simplest way to explain this. Here's what I'm using:</p> <pre><code>re.split('\W', 'foo/bar spam\neggs') -&gt; ['foo', 'bar', 'spam', 'eggs'] </code></pre> <p>Here's what I want:</p> <pre><code>someMethod('\W', 'foo/bar spam\neggs') -&gt; ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre> <p...
75
2010-01-25T23:41:13Z
2,136,580
<pre><code>&gt;&gt;&gt; re.split('(\W)', 'foo/bar spam\neggs') ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre>
104
2010-01-25T23:45:19Z
[ "python", "regex" ]
In Python, how do I split a string and keep the separators?
2,136,556
<p>Here's the simplest way to explain this. Here's what I'm using:</p> <pre><code>re.split('\W', 'foo/bar spam\neggs') -&gt; ['foo', 'bar', 'spam', 'eggs'] </code></pre> <p>Here's what I want:</p> <pre><code>someMethod('\W', 'foo/bar spam\neggs') -&gt; ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre> <p...
75
2010-01-25T23:41:13Z
22,287,116
<p>You can also split a string with an array of strings instead of a regular expression, like this:</p> <pre><code>def tokenizeString(aString, separators): #separators is an array of strings that are being used to split the the string. #sort separators in order of descending length separators.sort(key=len)...
1
2014-03-09T19:37:41Z
[ "python", "regex" ]
In Python, how do I split a string and keep the separators?
2,136,556
<p>Here's the simplest way to explain this. Here's what I'm using:</p> <pre><code>re.split('\W', 'foo/bar spam\neggs') -&gt; ['foo', 'bar', 'spam', 'eggs'] </code></pre> <p>Here's what I want:</p> <pre><code>someMethod('\W', 'foo/bar spam\neggs') -&gt; ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre> <p...
75
2010-01-25T23:41:13Z
34,004,805
<pre><code># This keeps all separators in result ########################################################################## import re st="%%(c+dd+e+f-1523)%%7" sh=re.compile('[\+\-//\*\&lt;\&gt;\%\(\)]') def splitStringFull(sh, st): ls=sh.split(st) lo=[] start=0 for l in ls: if not l : continue ...
1
2015-11-30T17:49:24Z
[ "python", "regex" ]
In Python, how do I split a string and keep the separators?
2,136,556
<p>Here's the simplest way to explain this. Here's what I'm using:</p> <pre><code>re.split('\W', 'foo/bar spam\neggs') -&gt; ['foo', 'bar', 'spam', 'eggs'] </code></pre> <p>Here's what I want:</p> <pre><code>someMethod('\W', 'foo/bar spam\neggs') -&gt; ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre> <p...
75
2010-01-25T23:41:13Z
34,120,478
<p><strong>Another no-regex solution that works well on Python 3</strong></p> <pre><code># Split strings and keep separator test_strings = ['&lt;Hello&gt;', 'Hi', '&lt;Hi&gt; &lt;Planet&gt;', '&lt;', ''] def split_and_keep(s, sep): if not s: return [''] # consistent with string.split() # Find replacement chara...
4
2015-12-06T17:35:18Z
[ "python", "regex" ]
In Python, how do I split a string and keep the separators?
2,136,556
<p>Here's the simplest way to explain this. Here's what I'm using:</p> <pre><code>re.split('\W', 'foo/bar spam\neggs') -&gt; ['foo', 'bar', 'spam', 'eggs'] </code></pre> <p>Here's what I want:</p> <pre><code>someMethod('\W', 'foo/bar spam\neggs') -&gt; ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre> <p...
75
2010-01-25T23:41:13Z
37,284,609
<p>If you are splitting on newline, use <a href="https://docs.python.org/3/library/stdtypes.html#str.splitlines" rel="nofollow"><code>splitlines(True)</code></a>.</p> <pre><code>&gt;&gt;&gt; 'line 1\nline 2\nline without newline'.splitlines(True) ['line 1\n', 'line 2\n', 'line without newline'] </code></pre> <p>(Not ...
1
2016-05-17T19:20:51Z
[ "python", "regex" ]
In Python, how do I split a string and keep the separators?
2,136,556
<p>Here's the simplest way to explain this. Here's what I'm using:</p> <pre><code>re.split('\W', 'foo/bar spam\neggs') -&gt; ['foo', 'bar', 'spam', 'eggs'] </code></pre> <p>Here's what I want:</p> <pre><code>someMethod('\W', 'foo/bar spam\neggs') -&gt; ['foo', '/', 'bar', ' ', 'spam', '\n', 'eggs'] </code></pre> <p...
75
2010-01-25T23:41:13Z
39,168,047
<p>If one wants to split string while keeping separators by regex without capturing group:</p> <pre><code>def finditer_with_separators(regex, s): matches = [] prev_end = 0 for match in regex.finditer(s): match_start = match.start() if (prev_end != 0 or match_start &gt; 0) and match_start !=...
0
2016-08-26T13:56:13Z
[ "python", "regex" ]
Error handling in SQLAlchemy
2,136,739
<p>How do you handle errors in SQLAlchemy? I am relatively new to SQLAlchemy and do not know yet.</p> <p>Before I used SQLAlchemy, I would do things like</p> <pre><code>status = db.query("INSERT INTO users ...") if (!status): raise Error, db.error </code></pre> <p>But now I am coding in SQLAlchemy and I do thing...
24
2010-01-26T00:21:29Z
2,136,751
<p>SQLAlchemy will raise an exception on error....</p>
1
2010-01-26T00:24:19Z
[ "python", "sqlalchemy" ]
Error handling in SQLAlchemy
2,136,739
<p>How do you handle errors in SQLAlchemy? I am relatively new to SQLAlchemy and do not know yet.</p> <p>Before I used SQLAlchemy, I would do things like</p> <pre><code>status = db.query("INSERT INTO users ...") if (!status): raise Error, db.error </code></pre> <p>But now I am coding in SQLAlchemy and I do thing...
24
2010-01-26T00:21:29Z
2,137,389
<p>Your example says:</p> <pre><code>status = db.query("INSERT INTO users ...") if (!status): raise Error, db.error </code></pre> <p>That seems to mean that you want to raise an exception if there's some error on the query (with <code>raise Error, db.error</code>). However sqlalchemy already does that for you - s...
40
2010-01-26T03:37:08Z
[ "python", "sqlalchemy" ]
Error handling in SQLAlchemy
2,136,739
<p>How do you handle errors in SQLAlchemy? I am relatively new to SQLAlchemy and do not know yet.</p> <p>Before I used SQLAlchemy, I would do things like</p> <pre><code>status = db.query("INSERT INTO users ...") if (!status): raise Error, db.error </code></pre> <p>But now I am coding in SQLAlchemy and I do thing...
24
2010-01-26T00:21:29Z
2,139,956
<p>Take a look at example at sqlalchemy.org <a href="http://www.sqlalchemy.org/trac/wiki/UsageRecipes/UniqueConstraintExceptionHandling" rel="nofollow">http://www.sqlalchemy.org/trac/wiki/UsageRecipes/UniqueConstraintExceptionHandling</a></p>
3
2010-01-26T14:22:48Z
[ "python", "sqlalchemy" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,136,803
<p>Let's say you have three classes: Enemy1, Enemy2, Enemy3. This is how you instantiate them directly:</p> <pre><code>Enemy1() Enemy2() Enemy3() </code></pre> <p>but this will also work:</p> <pre><code>x = Enemy1 x() x = Enemy2 x() x = Enemy3 x() </code></pre> <p>Is this what you meant?</p>
0
2010-01-26T00:33:25Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,136,812
<p>If you haven't found it yet, here is <a href="http://diveintopython.net/object_oriented_framework/index.html">Dive into Python's chapter on object-oriented programming</a>.</p> <p>Here are some more <a href="http://wiki.python.org/moin/SimplePrograms">examples</a>, scroll to BankAccount.</p> <hr> <p>You can call ...
7
2010-01-26T00:34:01Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,136,831
<p>This is a very strange question to ask, specifically of python, so being more specific will definitely help me answer it. As is, I'll try to take a stab at it.</p> <p>I'm going to assume what you want to do is create a new instance of a datastructure and give it a variable. For this example I'll use the dictionar...
0
2010-01-26T00:38:03Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,136,851
<p>I think you can use <code>eval</code>. Something like this</p> <pre><code>def toclass(strcls): return eval(strcls)() </code></pre>
-1
2010-01-26T00:42:21Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,136,854
<p>Given your edit i assume you have the class name as a string and want to instantiate the class? Just use a dictionary as a dispatcher.</p> <pre><code>class Foo(object): pass class Bar(object): pass dispatch_dict = {"Foo": Foo, "Bar": Bar} dispatch_dict["Foo"]() # returns an instance of Foo </code></pre>
12
2010-01-26T00:43:14Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,136,856
<p>If you just want to pass a class to a function, so that this function can create new instances of that class, just treat the class like any other value you would give as a parameter:</p> <pre><code>def printinstance(someclass): print someclass() </code></pre> <p>Result:</p> <pre><code>&gt;&gt;&gt; printinstance...
1
2010-01-26T00:43:42Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
2,139,347
<p>Rather than use multiple classes or class inheritance, perhaps a single Toy class that knows what "kind" it is:</p> <pre><code>class Toy: num = 0 def __init__(self, name, kind, *args): self.name = name self.kind = kind self.data = args self.num = Toy.num Toy.num += 1 ...
1
2010-01-26T12:35:54Z
[ "python" ]
Creating an Instance of a Class with a variable in Python
2,136,760
<p>I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.</p> <p>I created a class <code>Toy</code> and want to create a function, <code>getNewToy(name, data1, data2, data3, data4, data5)</code>.</p> <p>I want this function to create a new instance of th...
8
2010-01-26T00:26:26Z
37,867,332
<p>You can create variable like this:</p> <pre><code>x = 10 print(x) </code></pre> <p>Or this:</p> <pre><code>globals()['y'] = 100 print(y) </code></pre> <p>Lets create a new class:</p> <pre><code>class Foo(object): def __init__(self): self.name = 'John' </code></pre> <p>You can create class instance...
0
2016-06-16T18:57:35Z
[ "python" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
2,136,872
<p>PyInstaller will create a single-file executable if you use the <code>--onefile</code> option (though what it actually does is extracts then runs itself).</p> <p>There's a simple PyInstaller tutorial <a href="http://bytes.com/topic/python/insights/579554-simple-guide-using-pyinstaller">here</a>. If you have any qu...
17
2010-01-26T00:48:36Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
2,136,989
<p>I would join @Nicholas in recommending <a href="http://www.pyinstaller.org/">PyInstaller</a> (with the <code>--onefile</code> flag), but <em>be warned</em>: do <strong>not</strong> use the "latest release", PyInstaller 1.3 -- it's <em>years</em> old. Use the "pre-release" 1.4, download it <a href="http://www.pyinst...
6
2010-01-26T01:23:15Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
2,137,143
<p>you may want to see if your app can run under IronPython. If so, you can compile it to an exe <a href="http://www.codeplex.com/IronPython" rel="nofollow">http://www.codeplex.com/IronPython</a></p>
1
2010-01-26T02:15:55Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
2,344,598
<p>Using py2exe, include this in your setup.py: </p> <pre><code>from distutils.core import setup import py2exe, sys, os sys.argv.append('py2exe') setup( options = {'py2exe': {'bundle_files': 1}}, windows = [{'script': "YourScript.py"}], zipfile = None, ) </code></pre> <p>then you can run it through com...
10
2010-02-26T20:26:44Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
14,022,642
<p>i would recommend going to <a href="http://sourceforge.net/projects/py2exe/files/latest/download?source=files">http://sourceforge.net/projects/py2exe/files/latest/download?source=files</a> to download py2exe. Then make a python file named setup.py. Inside it, type</p> <pre><code>from distutils.core import setup im...
7
2012-12-24T14:36:36Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
19,267,833
<p>You could create an installer for you EXE file by:<br> 1. Press WinKey + R<br> 2. Type "iexpress" (without quotes) into the run window<br> 3. Complete the wizard for creating the installation program.<br> 4. Distribute the completed EXE.</p>
1
2013-10-09T09:19:49Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Process to convert simple Python script into Windows executable
2,136,837
<p>I wrote a script that will help a Windows user in her daily life. I want to simply send her the .exe and not ask her to install python, dlls or have to deal with any additional files.</p> <p>I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused a...
52
2010-01-26T00:39:11Z
24,302,694
<p>1) Get py2exe from <a href="http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/" rel="nofollow">here</a>, according to your Python version.</p> <p>2) Make a file called "setup.py" in the same folder as the script you want to convert, having the following code:</p> <blockquote> <pre><code>from distutils.core...
4
2014-06-19T09:00:51Z
[ "python", "packaging", "compilation", "py2exe", "software-distribution" ]
Named pipe is not flushing in Python
2,136,844
<p>I have a named pipe created via the os.mkfifo() command. I have two different Python processes accessing this named pipe, process A is reading, and process B is writing. Process A uses the select function to determine when there is data available in the fifo/pipe. Despite the fact that process B flushes after each w...
4
2010-01-26T00:40:43Z
2,136,921
<p>The flush operation is irrelevant for named pipes; the data for named pipes is held strictly in memory, and won't be released until it is read or the FIFO is closed.</p>
0
2010-01-26T01:00:50Z
[ "python", "select", "ipc", "named-pipes", "flush" ]
Named pipe is not flushing in Python
2,136,844
<p>I have a named pipe created via the os.mkfifo() command. I have two different Python processes accessing this named pipe, process A is reading, and process B is writing. Process A uses the select function to determine when there is data available in the fifo/pipe. Despite the fact that process B flushes after each w...
4
2010-01-26T00:40:43Z
2,200,679
<p>What APIs are you using? <code>os.read()</code> and <code>os.write()</code> don't buffer anything.</p>
1
2010-02-04T15:08:02Z
[ "python", "select", "ipc", "named-pipes", "flush" ]
Named pipe is not flushing in Python
2,136,844
<p>I have a named pipe created via the os.mkfifo() command. I have two different Python processes accessing this named pipe, process A is reading, and process B is writing. Process A uses the select function to determine when there is data available in the fifo/pipe. Despite the fact that process B flushes after each w...
4
2010-01-26T00:40:43Z
2,508,809
<p>To find out if Python's internal buffering is causing your problems, when running your scripts do "python -u" instead of "python". This will force python in to "unbuffered mode" which will cause all output to be printed instantaneously.</p>
1
2010-03-24T15:10:45Z
[ "python", "select", "ipc", "named-pipes", "flush" ]
shared data utilizing multiple processor in python
2,136,885
<p>I have a cpu intensive code which uses a heavy dictionary as data (around 250M data). I have a multicore processor and want to utilize it so that i can run more than one task at a time. The dictionary is mostly read only and may be updated once a day.<br> How can i write this in python without duplicating the dicti...
3
2010-01-26T00:51:22Z
2,136,901
<p>Use <a href="http://docs.python.org/library/shelve.html" rel="nofollow"><code>shelve</code></a> for the dictionary. Since writes are infrequent there shouldn't be an issue with sharing it.</p>
1
2010-01-26T00:54:57Z
[ "python", "concurrency", "shared-memory" ]
shared data utilizing multiple processor in python
2,136,885
<p>I have a cpu intensive code which uses a heavy dictionary as data (around 250M data). I have a multicore processor and want to utilize it so that i can run more than one task at a time. The dictionary is mostly read only and may be updated once a day.<br> How can i write this in python without duplicating the dicti...
3
2010-01-26T00:51:22Z
2,136,956
<p>You can share read-only data among processes simply with a <code>fork</code> (on Unix; no easy way on Windows), but that won't catch the "once a day change" (you'd need to put an explicit way in place for each process to update its own copy). Native Python structures like <code>dict</code> are just not designed to ...
1
2010-01-26T01:11:07Z
[ "python", "concurrency", "shared-memory" ]
shared data utilizing multiple processor in python
2,136,885
<p>I have a cpu intensive code which uses a heavy dictionary as data (around 250M data). I have a multicore processor and want to utilize it so that i can run more than one task at a time. The dictionary is mostly read only and may be updated once a day.<br> How can i write this in python without duplicating the dicti...
3
2010-01-26T00:51:22Z
2,137,158
<p>Take a look at this in the stdlib: <a href="http://docs.python.org/library/multiprocessing.html" rel="nofollow">http://docs.python.org/library/multiprocessing.html</a> There are a bunch of wonderful features that will allow you to share data structures between processes very easily.</p>
0
2010-01-26T02:21:53Z
[ "python", "concurrency", "shared-memory" ]
Can I unit test an inner function in python?
2,136,910
<p>Is there any way to write <code>unittests</code> or <code>doctests</code> for <code>innerfunc</code>?</p> <pre><code>def outerfunc(): def innerfunc(): do_something() return innerfunc() </code></pre>
8
2010-01-26T00:57:06Z
2,136,939
<p>Only if you provide a way to extract the inner function object itself, e.g.</p> <pre><code>def outerfunc(calltheinner=True): def innerfunc(): do_something() if calltheinner: return innerfunc() else: return innerfunc </code></pre> <p>If your outer function insists on hiding the i...
7
2010-01-26T01:06:17Z
[ "python", "unit-testing", "doctest" ]
Can I unit test an inner function in python?
2,136,910
<p>Is there any way to write <code>unittests</code> or <code>doctests</code> for <code>innerfunc</code>?</p> <pre><code>def outerfunc(): def innerfunc(): do_something() return innerfunc() </code></pre>
8
2010-01-26T00:57:06Z
3,854,136
<p>This is actually an old open Python issue: </p> <ul> <li><a href="http://bugs.python.org/issue1650090" rel="nofollow">Issue 1650090: doctest doesn't find nested functions</a></li> </ul> <p>There's a candidate patch (from 2007) that makes doctest find nested functions, but someone probably needs to push this.</p>
3
2010-10-04T09:55:54Z
[ "python", "unit-testing", "doctest" ]
Integer Field Math in Django
2,136,928
<pre><code>from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = mo...
1
2010-01-26T01:03:14Z
2,136,958
<p>Try overriding the <code>save</code> method on the model: </p> <pre><code>def save(self, *args, **kwargs): "update number available on save" self.available = self.inventory - self.committed super(Product, self).save(*args, **kwargs) </code></pre> <p>You could also put logic in there that would do some...
3
2010-01-26T01:12:04Z
[ "python", "django" ]
Integer Field Math in Django
2,136,928
<pre><code>from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = mo...
1
2010-01-26T01:03:14Z
2,136,997
<p>The property is actually removing the available integer field off the admin page it seems</p>
0
2010-01-26T01:26:32Z
[ "python", "django" ]
Integer Field Math in Django
2,136,928
<pre><code>from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = mo...
1
2010-01-26T01:03:14Z
2,137,302
<p>See the Django documentation for <a href="http://www.djangoproject.com/documentation/models/properties/" rel="nofollow">model properties</a></p>
0
2010-01-26T03:12:49Z
[ "python", "django" ]
Integer Field Math in Django
2,136,928
<pre><code>from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = mo...
1
2010-01-26T01:03:14Z
2,137,668
<p>You've bound both a Django field and a vanilla Python property to the same name on your model. One of these attributes is masking the other, which is why you're getting unexpected behavior in the Django admin. This is almost certainly <strong>not what you want</strong>.</p> <p>Override the save method and remove y...
1
2010-01-26T05:33:44Z
[ "python", "django" ]
Integer Field Math in Django
2,136,928
<pre><code>from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = mo...
1
2010-01-26T01:03:14Z
2,138,925
<p>Don is correct that you have the name <code>available</code> duplicated, because you have both a field and a property. Drop the field.</p> <p>This is what I said when I gave you the solution to this problem in your <a href="http://stackoverflow.com/questions/2111945/math-functions-as-well-as-flags">original questio...
1
2010-01-26T11:01:46Z
[ "python", "django" ]
Integer Field Math in Django
2,136,928
<pre><code>from django.db import models from django.contrib.auth.models import User class Product(models.Model): name = models.CharField(max_length = 127) description = models.TextField() code = models.CharField(max_length = 30) lot_no = models.CharField(max_length = 30) inventory = models.IntegerField() commited = mo...
1
2010-01-26T01:03:14Z
2,166,651
<p>It seems like you may have two problems; the overlapping available property+field and availability not showing up as you expect in the admin.</p> <p>Choose one way (property or field) to represent the availability and go with it. Don and Seth have shown a way to do it using a field and Daniel and Ignacio have sugg...
2
2010-01-30T02:53:58Z
[ "python", "django" ]
Does a library to prevent duplicate form submissions exist for django?
2,136,954
<p>I am trying to find a way to prevent users from double-submitting my forms. I have javascript that disables the submit button, but there is still an occasional user who finds a way to double-submit. </p> <p>I have a vision of a re-usable library that I could create to protect from this. </p> <p>In my ideal librar...
17
2010-01-26T01:10:52Z
2,137,637
<p>To be honest, your best bet (easy and good practice) is to issue a HTTPRedirect() to the thank you page, and if the thank you page is the same one as the form, that's OK. You can still do this.</p>
4
2010-01-26T05:19:15Z
[ "python", "django", "code-reuse" ]
Does a library to prevent duplicate form submissions exist for django?
2,136,954
<p>I am trying to find a way to prevent users from double-submitting my forms. I have javascript that disables the submit button, but there is still an occasional user who finds a way to double-submit. </p> <p>I have a vision of a re-usable library that I could create to protect from this. </p> <p>In my ideal librar...
17
2010-01-26T01:10:52Z
2,138,077
<p>One easy solution to this problem is to add a unique hash to each form. Then you can have a rolling table of current forms. When a form is submitted, or the hash gets too old, you can expire it out of your table, and reject any form which does not have a matching hash in your table.</p> <p>The HTTPRedirect is the c...
6
2010-01-26T07:48:27Z
[ "python", "django", "code-reuse" ]
Does a library to prevent duplicate form submissions exist for django?
2,136,954
<p>I am trying to find a way to prevent users from double-submitting my forms. I have javascript that disables the submit button, but there is still an occasional user who finds a way to double-submit. </p> <p>I have a vision of a re-usable library that I could create to protect from this. </p> <p>In my ideal librar...
17
2010-01-26T01:10:52Z
2,147,088
<p>It is always good to use the redirect-after-post method. This prevents user from accidently resubmitting the form using refresh function from the browser. It is also helpful even when you use the hash method. It's because without redirect after a POST, in case of hitting Back/Refresh button, user will see a question...
2
2010-01-27T13:23:43Z
[ "python", "django", "code-reuse" ]
Does a library to prevent duplicate form submissions exist for django?
2,136,954
<p>I am trying to find a way to prevent users from double-submitting my forms. I have javascript that disables the submit button, but there is still an occasional user who finds a way to double-submit. </p> <p>I have a vision of a re-usable library that I could create to protect from this. </p> <p>In my ideal librar...
17
2010-01-26T01:10:52Z
2,157,688
<p>You can use a session to store the hash </p> <pre><code>import hashlib def contact(request): if request.method == 'POST': form = MyForm(request.POST) #join all the fields in one string hashstring=hashlib.sha1(fieldsstring) if request.session.get('sesionform')!=hashstring: ...
10
2010-01-28T20:24:25Z
[ "python", "django", "code-reuse" ]
Does a library to prevent duplicate form submissions exist for django?
2,136,954
<p>I am trying to find a way to prevent users from double-submitting my forms. I have javascript that disables the submit button, but there is still an occasional user who finds a way to double-submit. </p> <p>I have a vision of a re-usable library that I could create to protect from this. </p> <p>In my ideal librar...
17
2010-01-26T01:10:52Z
2,201,400
<p>Kristian Damian's answer is really a great suggestion. I just thought of a slight variation on that theme, but it might have more overhead.</p> <p>You could try implementing something that is used in <a href="http://bitbucket.org/jespern/django-piston" rel="nofollow">django-piston</a> for <code>BaseHandler</code> ...
3
2010-02-04T16:41:20Z
[ "python", "django", "code-reuse" ]
Python multiple inheritance: which __new__ to call?
2,137,150
<p>I have a class <code>Parent</code>. I want to define a <code>__new__</code> for <code>Parent</code> so it does some magic upon instantiation (for why, see footnote). I also want children classes to inherit from this and other classes to get Parent's features. The <code>Parent</code>'s <code>__new__</code> would retu...
4
2010-01-26T02:18:39Z
2,137,205
<p>I think this will get you what you want:</p> <pre><code>return super(Parent, cls).__new__(cls, *args, **kwargs) </code></pre> <p>and you won't need the <code>bases</code> keyword argument. Unless I'm getting you wrong and you're putting that in there on purpose.</p>
4
2010-01-26T02:38:01Z
[ "python", "new-operator", "multiple-inheritance", "class-hierarchy" ]
Python Process blocked by urllib2
2,137,187
<p>I set up a process that read a queue for incoming urls to download but when urllib2 open a connection the system hangs.</p> <pre><code>import urllib2, multiprocessing from threading import Thread from Queue import Queue from multiprocessing import Queue as ProcessQueue, Process def download(url): """Download a...
7
2010-01-26T02:31:39Z
2,139,284
<p>The issue here is not urllib2, but the use of the multiprocessing module. When using the multiprocessing module under Windows, you must not use code that runs immediately when importing your module - instead, put things in the main module inside a <code>if __name__=='__main__'</code> block. See section "Safe importi...
4
2010-01-26T12:22:50Z
[ "python", "multithreading", "urllib2", "multiprocess" ]
urllib2 times out but doesn't close socket connection
2,137,335
<p>I'm making a python URL grabber program. For my purposes, I want it to time out really really fast, so I'm doing</p> <p><code>urllib2.urlopen("http://.../", timeout=2)</code></p> <p>Of course it times out correctly as it should. However, it doesn't bother to close the connection to the server, so the server thinks...
0
2010-01-26T03:18:36Z
2,137,417
<p>This is SUCH a hack, but the following code works. If the request is in another function AND it does not raise an exception, then the socket is always closed.</p> <pre><code>def _fetch(self, url): try: return urllib2.urlopen(urllib2.Request(url), timeout=5).read() except urllib2.URLError, e: ...
0
2010-01-26T03:46:52Z
[ "python", "http", "sockets", "timeout", "urllib2" ]
urllib2 times out but doesn't close socket connection
2,137,335
<p>I'm making a python URL grabber program. For my purposes, I want it to time out really really fast, so I'm doing</p> <p><code>urllib2.urlopen("http://.../", timeout=2)</code></p> <p>Of course it times out correctly as it should. However, it doesn't bother to close the connection to the server, so the server thinks...
0
2010-01-26T03:18:36Z
2,137,482
<p>I have a suspicion that the socket is still open in the stack frames. When Python raises an exception it stores the stack frames so debuggers and other tools can view the stack and introspect values.</p> <p>For historical reasons, and now for backwards compatibility, the stack information is stored (on a per-thread...
2
2010-01-26T04:10:05Z
[ "python", "http", "sockets", "timeout", "urllib2" ]
Changing contents of currently displayed listbox in urwid/python2.6
2,137,354
<p>I'm writing a music player in python, with a cli using urwid. I intend to have the current playlist in a simpleListWalker, wrapped by a listbox, then columns, a pile, and finally a frame. </p> <p>How do I replace the entire contents of this listbox (or simpleListWalker) with something else?</p> <p>Relevant code:</...
6
2010-01-26T03:24:09Z
2,678,976
<pre><code>self.mainListContent[:] = [new, list, of, widgets] </code></pre> <p>should replace the whole list of widgets in place.</p> <p>Next time post your question to the mailing list or the IRC channel if you want a faster response!</p>
2
2010-04-20T21:58:14Z
[ "python", "urwid" ]
How to setup and run Python on Wampserver?
2,137,394
<p>Can anyone help me to set up Python to run on Wampserver. From what I've read so far you would need to use a combination of Wampser, Python, mod_pyhton, and adjustment to the Apache http.conf file. I've tried it but i belive i am having conflict when it comes to versions. Does anyone know of a cobination of versions...
10
2010-01-26T03:40:21Z
2,137,416
<p>How about using <a href="http://webpy.org/tutorial3.en" rel="nofollow">web.py</a> (<a href="http://webpy.org/download" rel="nofollow">download</a>) or <a href="http://www.djangoproject.com/" rel="nofollow">django</a>? </p> <p>They have their own web server, and you can also connect MySQL server with <a href="http:/...
2
2010-01-26T03:46:52Z
[ "python", "apache", "installation", "mod-python", "wampserver" ]
How to setup and run Python on Wampserver?
2,137,394
<p>Can anyone help me to set up Python to run on Wampserver. From what I've read so far you would need to use a combination of Wampser, Python, mod_pyhton, and adjustment to the Apache http.conf file. I've tried it but i belive i am having conflict when it comes to versions. Does anyone know of a cobination of versions...
10
2010-01-26T03:40:21Z
2,137,428
<p>Wampserver doesn't have addon for python/django, but XAMPP does.</p> <p>A good tutorial here:</p> <p><a href="http://jyotirmaya.blogspot.com/2008/11/xampp-python-django.html" rel="nofollow">http://jyotirmaya.blogspot.com/2008/11/xampp-python-django.html</a></p>
0
2010-01-26T03:50:32Z
[ "python", "apache", "installation", "mod-python", "wampserver" ]
How to setup and run Python on Wampserver?
2,137,394
<p>Can anyone help me to set up Python to run on Wampserver. From what I've read so far you would need to use a combination of Wampser, Python, mod_pyhton, and adjustment to the Apache http.conf file. I've tried it but i belive i am having conflict when it comes to versions. Does anyone know of a cobination of versions...
10
2010-01-26T03:40:21Z
2,137,429
<p>Do not use <code>mod_python</code>; it does not do what most people think it does. Use <a href="http://code.google.com/p/modwsgi/" rel="nofollow"><code>mod_wsgi</code></a> instead.</p>
3
2010-01-26T03:51:16Z
[ "python", "apache", "installation", "mod-python", "wampserver" ]
How to setup and run Python on Wampserver?
2,137,394
<p>Can anyone help me to set up Python to run on Wampserver. From what I've read so far you would need to use a combination of Wampser, Python, mod_pyhton, and adjustment to the Apache http.conf file. I've tried it but i belive i am having conflict when it comes to versions. Does anyone know of a cobination of versions...
10
2010-01-26T03:40:21Z
3,278,576
<p>Recognising that the post asks about mod_python, I'm posting the following, in case using CGI is acceptable.</p> <p>It has been a while since I got this to work, but I got CGI scripts written with Python to run under Wampserver with a couple simple things (although it didn't seem simple at the time):</p> <ul> <li>...
2
2010-07-19T05:07:11Z
[ "python", "apache", "installation", "mod-python", "wampserver" ]