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 strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 522,779 | <p>As an imperfect shortcut, how about mocking out <code>logging</code> in specific modules using something like <a href="http://pypi.python.org/pypi/MiniMock/" rel="nofollow">MiniMock</a>?</p>
<p>For example, if <code>my_module.py</code> was:</p>
<pre><code>import logging
class C(object):
def __init__(self, *arg... | 2 | 2009-02-07T00:27:15Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 522,899 | <p>You could try something like this:</p>
<pre><code># Create something that accepts anything
class Fake(object):
def __getattr__(self, key):
return self
def __call__(self, *args, **kwargs):
return True
# Replace the logging module
import sys
sys.modules["logging"] = Fake()
</code></pre>
<p>I... | 1 | 2009-02-07T01:30:41Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 524,226 | <p>I'd use some fancy logging decorator, or a bunch of them:</p>
<pre><code>def doLogging(logTreshold):
def logFunction(aFunc):
def innerFunc(*args, **kwargs):
if LOGLEVEL >= logTreshold:
print ">>Called %s at %s"%(aFunc.__name__, time.strftime("%H:%M:%S"))
... | 1 | 2009-02-07T17:59:32Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 526,078 | <p>What about using <a href="http://docs.python.org/library/logging.html?highlight=logging#logging.disable">logging.disable</a>?</p>
<p>I've also found I had to use <a href="http://docs.python.org/library/logging.html?highlight=logging#logging.Logger.isEnabledFor">logging.isEnabledFor</a> if the logging message is exp... | 19 | 2009-02-08T17:33:41Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 620,732 | <p>This is an issue in my project as well--logging ends up on profiler reports pretty consistently.</p>
<p>I've used the _ast module before in a fork of PyFlakes (<a href="http://github.com/kevinw/pyflakes" rel="nofollow">http://github.com/kevinw/pyflakes</a>) ... and it is definitely possible to do what you suggest i... | 1 | 2009-03-06T22:38:39Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 716,708 | <p>I've also seen assert used in this fashion.</p>
<pre><code>assert logging.warn('disable me with the -O option') is None
</code></pre>
<p>(I'm guessing that warn always returns none.. if not, you'll get an AssertionError</p>
<p>But really that's just a funny way of doing this:</p>
<pre><code>if __debug__: logging... | 4 | 2009-04-04T07:22:20Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 2,218,371 | <p>I like the 'if _<em>debug</em>' solution except that putting it in front of every call is a bit distracting and ugly. I had this same problem and overcame it by writing a script which automatically parses your source files and replaces logging statements with pass statements (and commented out copies of the logging... | 0 | 2010-02-07T21:16:58Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 2,807,939 | <p>:-) We used to call that a preprocessor and although C's preprocessor had some of those capablities, the "king of the hill" was the preprocessor for IBM mainframe PL/I. It provided extensive language support in the preprocessor (full assignments, conditionals, looping, etc.) and it was possible to write "programs t... | 1 | 2010-05-11T03:43:26Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 5,320,785 | <p>Use <a href="http://code.google.com/p/pypreprocessor/" rel="nofollow">pypreprocessor</a></p>
<p>Which can also be found on <a href="http://pypi.python.org/pypi/pypreprocessor" rel="nofollow">PYPI (Python Package Index)</a> and be fetched using pip.</p>
<p>Here's a basic usage example:</p>
<pre><code>from pyprepro... | 4 | 2011-03-16T03:36:10Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
How can I strip Python logging calls without commenting them out? | 522,730 | <p>Today I was thinking about a Python project I wrote about a year back where I used <code>logging</code> pretty extensively. I remember having to comment out a lot of logging calls in inner-loop-like scenarios (the 90% code) because of the overhead (<code>hotshot</code> indicated it was one of my biggest bottlenecks)... | 25 | 2009-02-07T00:08:11Z | 24,120,427 | <p>I am doing a project currently that uses extensive logging for testing logic and execution times for a data analysis API using the Pandas library. </p>
<p>I found this string with a similar concern - e.g. what is the overhead on the logging.debug statements even if the logging.basicConfig level is set to level=logg... | 0 | 2014-06-09T12:35:04Z | [
"python",
"optimization",
"logging",
"bytecode"
] |
how to search for specific file type with yahoo search API? | 522,781 | <p>Does anyone know if there is some parameter available for programmatic search on yahoo allowing to restrict results so only links to files of specific type will be returned (like PDF for example)?
It's possible to do that in GUI, but how to make it happen through API?</p>
<p>I'd very much appreciate a sample code i... | 1 | 2009-02-07T00:27:40Z | 522,787 | <p>Yes, there is:</p>
<p><a href="http://developer.yahoo.com/search/boss/boss_guide/Web_Search.html#id356163" rel="nofollow">http://developer.yahoo.com/search/boss/boss_guide/Web_Search.html#id356163</a></p>
| 0 | 2009-02-07T00:30:34Z | [
"python",
"yahoo-api",
"yahoo-search"
] |
how to search for specific file type with yahoo search API? | 522,781 | <p>Does anyone know if there is some parameter available for programmatic search on yahoo allowing to restrict results so only links to files of specific type will be returned (like PDF for example)?
It's possible to do that in GUI, but how to make it happen through API?</p>
<p>I'd very much appreciate a sample code i... | 1 | 2009-02-07T00:27:40Z | 526,491 | <p>Thank you.
I found myself that something like this works OK (file type is the first argument, and query is the second):</p>
<p>format = sys.argv[1]</p>
<p>query = " ".join(sys.argv[2:])</p>
<p>srch = create_search("Web", app_id, query=query, format=format)</p>
| 0 | 2009-02-08T21:54:07Z | [
"python",
"yahoo-api",
"yahoo-search"
] |
how to search for specific file type with yahoo search API? | 522,781 | <p>Does anyone know if there is some parameter available for programmatic search on yahoo allowing to restrict results so only links to files of specific type will be returned (like PDF for example)?
It's possible to do that in GUI, but how to make it happen through API?</p>
<p>I'd very much appreciate a sample code i... | 1 | 2009-02-07T00:27:40Z | 1,178,208 | <p>Here's what I do for this sort of thing. It exposes more of the parameters so you can tune it to your needs. This should print out the first ten PDFs URLs from the query "resume" [mine's not one of them ;) ]. You can download those URLs however you like.</p>
<p>The json dictionary that gets returned from the que... | 0 | 2009-07-24T14:52:02Z | [
"python",
"yahoo-api",
"yahoo-search"
] |
Python cannot create instances | 522,921 | <p>I am trying to create a simple Python extension using [PyCXX]. And I'm compiling against my Python 2.5 installation.</p>
<p>My goal is to be able to do the following in Python:</p>
<pre><code>import Cats
kitty = Cats.Kitty()
if type(kitty) == Cats.Kitty:
kitty.Speak()
</code></pre>
<p>But every time I try, ... | 4 | 2009-02-07T01:39:29Z | 523,041 | <p>I do'nt see it in the code, but sort of thing normally means it can't create an instance, which means it can't find a ctor. Are you sure you've got a ctor that <em>exactly</em> matches the expected signature?</p>
| 2 | 2009-02-07T03:05:25Z | [
"python",
"pycxx"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 523,366 | <p>It's simple:</p>
<pre><code>from django.http import HttpResponseRedirect
def myview(request):
...
return HttpResponseRedirect("/path/")
</code></pre>
<p>More info in the <a href="https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpResponseRedirect">official Django docs</a></p>
<p>... | 213 | 2009-02-07T07:14:37Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 2,080,377 | <p>There's actually a simpler way than having a view for each redirect - you can do it <em>directly</em> in <code>urls.py</code>:</p>
<pre><code>from django.http import HttpResponsePermanentRedirect
urlpatterns = patterns(
'',
# ...normal patterns here...
(r'^bad-old-link\.php',
lambda request: HttpR... | 37 | 2010-01-17T08:07:32Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 3,645,846 | <p>Since Django 1.1, you can also use the simpler <a href="http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#redirect">redirect</a> shortcut:</p>
<pre><code>from django.shortcuts import redirect
def myview(request):
return redirect('/path')
</code></pre>
<p>It also takes an optional permanent=True keyw... | 22 | 2010-09-05T11:09:03Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 3,841,632 | <p>Depending on what you want (i.e. if you do not want to do any additional pre-processing), it is simpler to just use Django's <code>redirect_to</code> generic view:</p>
<pre><code>from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
(r'^one/$', redirect_to, {'url': '/another/'}),
... | 109 | 2010-10-01T17:31:30Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 7,416,655 | <p>With Django version 1.3, the class based approach is:</p>
<pre><code>from django.conf.urls.defaults import patterns, url
from django.views.generic import RedirectView
urlpatterns = patterns('',
url(r'^some-url/$', RedirectView.as_view(url='/redirect-url/'), name='some_redirect'),
)
</code></pre>
<p>This examp... | 10 | 2011-09-14T12:55:33Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 9,368,564 | <p>You can do this in the Admin section. It's explained in the documentation.</p>
<p><a href="https://docs.djangoproject.com/en/dev/ref/contrib/redirects/" rel="nofollow">https://docs.djangoproject.com/en/dev/ref/contrib/redirects/</a></p>
| 1 | 2012-02-20T21:19:33Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 13,243,040 | <p>Beware. I did this on a development server and wanted to change it later. </p>
<ul>
<li><a href="http://stackoverflow.com/questions/6980192/firefox-5-caching-301-redirects">Firefox 5 'caching' 301 redirects</a></li>
</ul>
<p>I had to clear my caches to change it. In order to avoid this head-scratching in... | 6 | 2012-11-06T01:18:20Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 17,615,240 | <p>page_path = define in urls.py</p>
<pre><code>def deletePolls(request):
pollId = deletePool(request.GET['id'])
return HttpResponseRedirect("/page_path/")
</code></pre>
| 1 | 2013-07-12T12:45:36Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 22,300,866 | <p>If you want to redirect a whole subfolder, the <code>url</code> argument in <a href="https://docs.djangoproject.com/en/1.8/ref/class-based-views/base/#redirectview" rel="nofollow">RedirectView is actually interpolated</a>, so you can do something like this in <code>urls.py</code>:</p>
<pre><code>from django.conf.ur... | 8 | 2014-03-10T13:02:02Z | [
"python",
"django",
"redirect",
"location"
] |
Python + Django page redirect | 523,356 | <p>How do I accomplish a simple redirect (e.g. <code>cflocation</code> in ColdFusion, or <code>header(location:http://)</code> in Django)?</p>
| 131 | 2009-02-07T07:08:03Z | 24,191,391 | <p>This should work in most versions of django, I am using it in 1.6.5:</p>
<pre><code>from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
urlpatterns = patterns('',
....
url(r'^(?P<location_id>\d+)/$', lambda x, location_id: HttpResponseRedirect(reverse('dailyreport... | 0 | 2014-06-12T18:23:52Z | [
"python",
"django",
"redirect",
"location"
] |
How do I layout a 3 pane window using wxPython? | 523,363 | <p>I am trying to find a simple way to layout a 3 pane window using wxPython.</p>
<p>I want to have a tree list in the left pane, then have a right pane that is split into two - with an edit component in the top part and a grid component in the bottom part.</p>
<p>Something along the lines of:</p>
<pre>
------------... | 5 | 2009-02-07T07:12:13Z | 523,377 | <p>You should use wxSplitter, <a href="http://wiki.wxpython.org/ProportionalSplitterWindow" rel="nofollow">here's</a> an example. Another one <a href="http://www.zetcode.com/wxpython/widgets/#splitterwindow" rel="nofollow">here</a>. And <a href="http://wiki.wxpython.org/AnotherTutorial" rel="nofollow">another</a>.</p>
| 3 | 2009-02-07T07:20:29Z | [
"python",
"layout",
"wxpython",
"elasticlayout"
] |
How do I layout a 3 pane window using wxPython? | 523,363 | <p>I am trying to find a simple way to layout a 3 pane window using wxPython.</p>
<p>I want to have a tree list in the left pane, then have a right pane that is split into two - with an edit component in the top part and a grid component in the bottom part.</p>
<p>Something along the lines of:</p>
<pre>
------------... | 5 | 2009-02-07T07:12:13Z | 523,485 | <p>First of all download <a href="http://wxglade.sourceforge.net/">wxGlade</a> a gui builder for wxPython (alternative <a href="http://xrced.sourceforge.net/">XRCed</a>, i prefere wxGlade).</p>
<p>Then you have to decide if you want to use a <a href="http://www.wxpython.org/docs/api/wx.GridSizer-class.html">GridSizer<... | 7 | 2009-02-07T09:08:11Z | [
"python",
"layout",
"wxpython",
"elasticlayout"
] |
How do I layout a 3 pane window using wxPython? | 523,363 | <p>I am trying to find a simple way to layout a 3 pane window using wxPython.</p>
<p>I want to have a tree list in the left pane, then have a right pane that is split into two - with an edit component in the top part and a grid component in the bottom part.</p>
<p>Something along the lines of:</p>
<pre>
------------... | 5 | 2009-02-07T07:12:13Z | 524,313 | <p>You could consider using the <a href="http://docs.wxwidgets.org/stable/wx_wxauioverview.html#wxauioverview" rel="nofollow">wx.aui</a> advanced user interface module, as it allows you to build UIs like this very easily. Also the user can then minimise, maximise, and drag the panes around as they see fit, or not. It's... | 2 | 2009-02-07T18:31:34Z | [
"python",
"layout",
"wxpython",
"elasticlayout"
] |
How do I layout a 3 pane window using wxPython? | 523,363 | <p>I am trying to find a simple way to layout a 3 pane window using wxPython.</p>
<p>I want to have a tree list in the left pane, then have a right pane that is split into two - with an edit component in the top part and a grid component in the bottom part.</p>
<p>Something along the lines of:</p>
<pre>
------------... | 5 | 2009-02-07T07:12:13Z | 532,873 | <p>This is a very simple layout using wx.aui and three panels. I guess you can easily adapt it to suit your needs.</p>
<p>Orjanp...</p>
<pre><code>import wx
import wx.aui
class MyFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.mgr = wx.aui.AuiManager... | 7 | 2009-02-10T15:50:22Z | [
"python",
"layout",
"wxpython",
"elasticlayout"
] |
How to scale an image without occasionally inverting it (with the Python Imaging Library) | 523,503 | <p>When resizing images along the lines shown <a href="http://stackoverflow.com/questions/400788/resize-image-in-python-without-losing-exif-data">in this question</a> occasionally the resulting image is inverted. About 1% of the images I resize are inverted, the rest is fine. So far I was unable to find out what is dif... | -1 | 2009-02-07T09:29:37Z | 523,518 | <p>Your original image won't display for me; Firefox says</p>
<pre><code>The image âhttp://images.hudora.de/o/NIRV2MRR3XJGR52JATL6BOVMQMFSV54I01.jpegâ
cannot be displayed, because it contains errors.
</code></pre>
<p>This suggests that the problem arises when you attempt to resize a corrupted JPEG, and indeed yo... | 2 | 2009-02-07T09:39:38Z | [
"python",
"image-processing",
"python-imaging-library"
] |
How to scale an image without occasionally inverting it (with the Python Imaging Library) | 523,503 | <p>When resizing images along the lines shown <a href="http://stackoverflow.com/questions/400788/resize-image-in-python-without-losing-exif-data">in this question</a> occasionally the resulting image is inverted. About 1% of the images I resize are inverted, the rest is fine. So far I was unable to find out what is dif... | -1 | 2009-02-07T09:29:37Z | 538,458 | <p>I was finally able to find someone experienced in JPEG and with some additional knowledge was able to find a solution.</p>
<ol>
<li>JPEG is a very underspecified
Format.</li>
<li>The second image is a valid JPEG but it is in CMYK color space, not in RGB color space.</li>
<li>Design minded tools (read: things from A... | 3 | 2009-02-11T19:46:07Z | [
"python",
"image-processing",
"python-imaging-library"
] |
Google Apps HTTP Streaming with Python question | 523,579 | <p>I got a little question here:</p>
<p>Some time ago I implemented HTTP Streaming using PHP code, something similar to what is on this page:</p>
<p><a href="http://my.opera.com/WebApplications/blog/show.dml/438711#comments" rel="nofollow">http://my.opera.com/WebApplications/blog/show.dml/438711#comments</a></p>
<p>... | 0 | 2009-02-07T10:27:18Z | 524,133 | <p>That looks like a cgi code - I imagine the web server buffers the response from the cgi handlers. So it's really a matter of picking the right tools and making the right configuration.</p>
<p>I suggest using a wsgi server and take advantage of the streaming support wsgi has.</p>
<p>Here's your sample code translat... | 1 | 2009-02-07T17:10:36Z | [
"javascript",
"python",
"streaming"
] |
Google Apps HTTP Streaming with Python question | 523,579 | <p>I got a little question here:</p>
<p>Some time ago I implemented HTTP Streaming using PHP code, something similar to what is on this page:</p>
<p><a href="http://my.opera.com/WebApplications/blog/show.dml/438711#comments" rel="nofollow">http://my.opera.com/WebApplications/blog/show.dml/438711#comments</a></p>
<p>... | 0 | 2009-02-07T10:27:18Z | 524,332 | <p>Its highly likely App Engine buffers output. A quick search found this: <a href="http://code.google.com/appengine/docs/python/tools/webapp/buildingtheresponse.html" rel="nofollow">http://code.google.com/appengine/docs/python/tools/webapp/buildingtheresponse.html</a></p>
<blockquote>
<p>The out stream buffers al... | 3 | 2009-02-07T18:40:55Z | [
"javascript",
"python",
"streaming"
] |
BaseHTTPRequestHandler freezes while writing to self.wfile after installing Python 3.0 | 523,885 | <p>I'm starting to lose my head with this one.</p>
<p>I have a class that extends BaseHTTPRequestHandler. It works fine on
Python 2.5. And yesterday I was curious and decided to install Python
3.0 on my Mac (I followed this tutorial, to be sure I wasn't messing
things up: <a href="http://farmdev.com/thoughts/66/python... | 0 | 2009-02-07T14:57:29Z | 523,900 | <p>I would suggest develop a simple page that would dump the version details of the perl environment and confirm that now you are back on 2.5. Mostly in such scenarios there are some environment entries or binaries that are left out.</p>
| 0 | 2009-02-07T15:03:53Z | [
"python",
"sockets"
] |
BaseHTTPRequestHandler freezes while writing to self.wfile after installing Python 3.0 | 523,885 | <p>I'm starting to lose my head with this one.</p>
<p>I have a class that extends BaseHTTPRequestHandler. It works fine on
Python 2.5. And yesterday I was curious and decided to install Python
3.0 on my Mac (I followed this tutorial, to be sure I wasn't messing
things up: <a href="http://farmdev.com/thoughts/66/python... | 0 | 2009-02-07T14:57:29Z | 525,552 | <p>I'm sorry, it seems to have been a weird setting between routers <code>(mac <-> router <-> router <-> ISP)</code> here at home.</p>
<p>Small files ( < 100kB ) were served with no problem at all, but larger files got stuck. I found it out after formatting my mac, and realized that it was still h... | 0 | 2009-02-08T11:14:51Z | [
"python",
"sockets"
] |
Insert Command into Bash Shell | 524,068 | <p>Is there any way to inject a command into a bash prompt in Linux? I am working on a command history app - like the Ctrl+R lookup but different. I am using python for this.</p>
<p>I will show a list of commands from history based on the user's search term - if the user presses enter, the app will execute the command... | 0 | 2009-02-07T16:30:31Z | 524,092 | <p><a href="http://www.gnu.org/software/ncurses/ncurses.html" rel="nofollow" title="ncurses">ncurses</a> with its <a href="http://docs.python.org/library/curses.html" rel="nofollow" title="python port">python port</a> is a way to go, IMHO.</p>
| 1 | 2009-02-07T16:42:45Z | [
"python",
"linux",
"bash",
"shell",
"command"
] |
Insert Command into Bash Shell | 524,068 | <p>Is there any way to inject a command into a bash prompt in Linux? I am working on a command history app - like the Ctrl+R lookup but different. I am using python for this.</p>
<p>I will show a list of commands from history based on the user's search term - if the user presses enter, the app will execute the command... | 0 | 2009-02-07T16:30:31Z | 524,104 | <p>You can do this, but only if the shell runs as a subprocess of your Python program; you can't feed content into the stdin of your parent process. (If you could, UNIX would have a host of related security issues when folks run processes with fewer privileges than the calling shell!)</p>
<p>If you're familiar with ho... | 3 | 2009-02-07T16:50:09Z | [
"python",
"linux",
"bash",
"shell",
"command"
] |
Insert Command into Bash Shell | 524,068 | <p>Is there any way to inject a command into a bash prompt in Linux? I am working on a command history app - like the Ctrl+R lookup but different. I am using python for this.</p>
<p>I will show a list of commands from history based on the user's search term - if the user presses enter, the app will execute the command... | 0 | 2009-02-07T16:30:31Z | 740,490 | <p>See <a href="http://docs.python.org/library/readline.html" rel="nofollow">readline</a> module. It implements all these features.</p>
| 3 | 2009-04-11T17:32:30Z | [
"python",
"linux",
"bash",
"shell",
"command"
] |
Insert Command into Bash Shell | 524,068 | <p>Is there any way to inject a command into a bash prompt in Linux? I am working on a command history app - like the Ctrl+R lookup but different. I am using python for this.</p>
<p>I will show a list of commands from history based on the user's search term - if the user presses enter, the app will execute the command... | 0 | 2009-02-07T16:30:31Z | 740,529 | <p>If I understand correctly, you would like history behaviour similar to that of bash in
a python app. If this is what you want the <a href="http://en.wikipedia.org/wiki/GNU%5Freadline" rel="nofollow">GNU Readline Library</a> is the way to go.</p>
<p>There is a python wrapper <a href="http://docs.python.org/library/... | 3 | 2009-04-11T17:55:56Z | [
"python",
"linux",
"bash",
"shell",
"command"
] |
Is there a Python equivalent of Groovy/Grails for Java | 524,147 | <p>I'm thinking of something like Jython/Jango? Does this exist? Or does Jython allow you to do everything-Python in Java including Django (I'm not sure how Jython differs from Python)?</p>
| 3 | 2009-02-07T17:21:41Z | 524,172 | <p><a href="http://wiki.python.org/jython/DjangoOnJython">http://wiki.python.org/jython/DjangoOnJython</a></p>
| 8 | 2009-02-07T17:32:47Z | [
"python",
"django",
"grails",
"groovy",
"jython"
] |
Is there a Python equivalent of Groovy/Grails for Java | 524,147 | <p>I'm thinking of something like Jython/Jango? Does this exist? Or does Jython allow you to do everything-Python in Java including Django (I'm not sure how Jython differs from Python)?</p>
| 3 | 2009-02-07T17:21:41Z | 524,201 | <p>"I'm not sure how Jython differs from Python"</p>
<p><a href="http://www.jython.org/Project/" rel="nofollow">http://www.jython.org/Project/</a></p>
<blockquote>
<p>Jython is an implementation of the
high-level, dynamic, object-oriented
language Python seamlessly integrated
with the Java platform.</p>
</blo... | 3 | 2009-02-07T17:48:53Z | [
"python",
"django",
"grails",
"groovy",
"jython"
] |
Is there a Python equivalent of Groovy/Grails for Java | 524,147 | <p>I'm thinking of something like Jython/Jango? Does this exist? Or does Jython allow you to do everything-Python in Java including Django (I'm not sure how Jython differs from Python)?</p>
| 3 | 2009-02-07T17:21:41Z | 4,229,750 | <p><a href="http://turbogears.org/" rel="nofollow">http://turbogears.org/</a></p>
<p>might be closer to what you are looking for</p>
| 1 | 2010-11-19T21:54:43Z | [
"python",
"django",
"grails",
"groovy",
"jython"
] |
How to externally populate a Django model? | 524,214 | <p>What is the best idea to fill up data into a Django model from an external source?</p>
<p>E.g. I have a model Run, and runs data in an XML file, which changes weekly.</p>
<p>Should I create a view and call that view URL from a curl cronjob (with the advantage that that data can be read anytime, not only when the c... | 8 | 2009-02-07T17:54:54Z | 524,239 | <p>You don't need to create a view, you should just trigger a python script with the appropriate <a href="http://stackoverflow.com/questions/383073/django-how-can-i-use-my-model-classes-to-interact-with-my-database-from-outside/383089#383089">Django environment settings configured</a>. Then call your models directly t... | 4 | 2009-02-07T18:03:44Z | [
"python",
"django",
"django-models"
] |
How to externally populate a Django model? | 524,214 | <p>What is the best idea to fill up data into a Django model from an external source?</p>
<p>E.g. I have a model Run, and runs data in an XML file, which changes weekly.</p>
<p>Should I create a view and call that view URL from a curl cronjob (with the advantage that that data can be read anytime, not only when the c... | 8 | 2009-02-07T17:54:54Z | 524,333 | <p>There is excellent way to do some maintenance-like jobs in project environment- write a <a href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/#howto-custom-management-commands">custom manage.py command</a>. It takes all environment configuration and other stuff allows you to concentrate on c... | 10 | 2009-02-07T18:43:12Z | [
"python",
"django",
"django-models"
] |
How to externally populate a Django model? | 524,214 | <p>What is the best idea to fill up data into a Django model from an external source?</p>
<p>E.g. I have a model Run, and runs data in an XML file, which changes weekly.</p>
<p>Should I create a view and call that view URL from a curl cronjob (with the advantage that that data can be read anytime, not only when the c... | 8 | 2009-02-07T17:54:54Z | 524,401 | <p>"create a python script and install that script as a cron (with DJANGO _SETTINGS _MODULE variable setup before executing the script)?" </p>
<p>First, be sure to declare your Forms in a separate module (e.g. <code>forms.py</code>) </p>
<p>Then, you can write batch loaders that look like this. (We have a LOT of th... | 2 | 2009-02-07T19:26:13Z | [
"python",
"django",
"django-models"
] |
How to externally populate a Django model? | 524,214 | <p>What is the best idea to fill up data into a Django model from an external source?</p>
<p>E.g. I have a model Run, and runs data in an XML file, which changes weekly.</p>
<p>Should I create a view and call that view URL from a curl cronjob (with the advantage that that data can be read anytime, not only when the c... | 8 | 2009-02-07T17:54:54Z | 524,414 | <p>I've used cron to update my DB using both a script and a view. From cron's point of view it doesn't really matter which one you choose. As you've noted, though, it's hard to beat the simplicity of firing up a browser and hitting a URL if you ever want to update at a non-scheduled interval.</p>
<p>If you go the vi... | 2 | 2009-02-07T19:33:52Z | [
"python",
"django",
"django-models"
] |
How to 'zoom' in on a section of the Mandelbrot set? | 524,291 | <p>I have created a Python file to generate a Mandelbrot set image. The original maths code was not mine, so I do not understand it - I only heavily modified it to make it about 250x faster (Threads rule!).</p>
<p>Anyway, I was wondering how I could modify the maths part of the code to make it render one specific bit.... | 5 | 2009-02-07T18:22:48Z | 524,312 | <p>The line:</p>
<pre><code>box=((-2,1.25),(0.5,-1.25))
</code></pre>
<p>is the bit that defines the area of coordinate space that is being rendered, so you just need to change this line. First coordinate pair is the top-left of the area, the second is the bottom right. </p>
<p>To get a new coordinate from the image... | 14 | 2009-02-07T18:31:16Z | [
"python",
"math",
"mandelbrot"
] |
How to 'zoom' in on a section of the Mandelbrot set? | 524,291 | <p>I have created a Python file to generate a Mandelbrot set image. The original maths code was not mine, so I do not understand it - I only heavily modified it to make it about 250x faster (Threads rule!).</p>
<p>Anyway, I was wondering how I could modify the maths part of the code to make it render one specific bit.... | 5 | 2009-02-07T18:22:48Z | 524,501 | <p>The key in understanding how to do this is to understand what the <code>coords =</code> line is doing:</p>
<pre><code>coords = (uleft[0] + (x/size[0]) * (xwidth),uleft[1] - (y/size[1]) * (ywidth))
</code></pre>
<p>Effectively, the <code>x</code> and <code>y</code> values you are looping through which correspond to... | 4 | 2009-02-07T20:19:36Z | [
"python",
"math",
"mandelbrot"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,562 | <p>This is the kind of thing you really shouldn't do with a regular expression. Just parse the string one character at a time, keeping track of opening/closing parentheses.</p>
<p>If this is all you're looking for, you definitely don't need a full-blown C++ grammar lexer/parser. If you want practice, you can write a l... | 19 | 2009-02-07T20:50:09Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,563 | <p>This is a great example of using the wrong tool for the job. Regular expressions do not handle arbitrarily nested sub-matches very well. What you should do instead is use a real lexer and parser (a grammar for C++ should be easy to find) and look for unexpectedly empty loop bodies.</p>
| 7 | 2009-02-07T20:51:09Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,570 | <p>I wouldn't even pay attention to the contents of the parens.</p>
<p>Just match any line that starts with <code>for</code> and ends with semi-colon:</p>
<pre><code>^\t*for.+;$
</code></pre>
<p>Unless you've got <code>for</code> statements split over multiple lines, that will work fine?</p>
| 2 | 2009-02-07T20:54:36Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,575 | <p>Greg is absolutely correct. This kind of parsing cannot be done with regular expressions. I suppose it is possible to build some horrendous monstrosity that would work for many cases, but then you'll just run across something that does.</p>
<p>You really need to use more traditional parsing techniques. For exa... | 1 | 2009-02-07T20:57:32Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,588 | <p>I don't know that regex would handle something like that very well. Try something like this</p>
<pre><code>line = line.Trim();
if(line.StartsWith("for") && line.EndsWith(";")){
//your code here
}
</code></pre>
| 1 | 2009-02-07T21:08:02Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,624 | <p>You could write a little, very simple routine that does it, without using a regular expression:</p>
<ul>
<li>Set a position counter <code>pos</code> so that is points to just before the opening bracket after your <code>for</code> or <code>while</code>. </li>
<li>Set an open brackets counter <code>openBr</code> to <... | 77 | 2009-02-07T21:29:57Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,677 | <p>Another thought that ignores parentheses and treats the <code>for</code> as a construct holding three semicolon-delimited values:</p>
<pre><code>for\s*\([^;]+;[^;]+;[^;]+\)\s*;
</code></pre>
<p>This option works even when split over multiple lines (once MULTILINE enabled), but assumes that <code>for ( ... ; ... ; ... | 1 | 2009-02-07T21:59:38Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 524,979 | <p>Try this regexp</p>
<pre><code>^\s*(for|while)\s*
\(
(?P<balanced>
[^()]*
|
(?P=balanced)
\)
\s*;\s
</code></pre>
<p>I removed the wrapping <code>\( \)</code> around <code>(?P=balanced)</code> and moved the <code>*</code> to behind the any not paren sequence. I have had this work with boost xpressive, and r... | 2 | 2009-02-08T01:53:09Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Regular expression to detect semi-colon terminated C++ for & while loops | 524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | 25 | 2009-02-07T20:43:52Z | 11,725,855 | <p>Not a Python solution (maybe you could write a wrapper...)</p>
<p>First, download lexertl (<a href="http://www.benhanson.net/lexertl.html" rel="nofollow">http:/www.benhanson.net/lexertl.html</a>), then:</p>
<pre><code>#include <algorithm>
#include "lexertl/generator.hpp"
#include <iostream>
#include "l... | 1 | 2012-07-30T16:42:32Z | [
"c++",
"python",
"regex",
"parsing",
"recursion"
] |
Does Python have class prototypes (or forward declarations)? | 524,714 | <p>I have a series of Python classes in a file. Some classes reference others.</p>
<p>My code is something like this:</p>
<pre><code>class A():
pass
class B():
c = C()
class C():
pass
</code></pre>
<p>Trying to run that, I get <code>NameError: name 'C' is not defined</code>. Fair enough, but is there a... | 20 | 2009-02-07T22:21:50Z | 524,722 | <p>In Python you don't create a prototype per se, but you do need to understand the difference between "class attributes" and instance-level attributes. In the example you've shown above, you are declaring a class attribute on class B, not an instance-level attribute.</p>
<p>This is what you are looking for:</p>
<pr... | 30 | 2009-02-07T22:27:33Z | [
"python",
"class",
"oop",
"prototype"
] |
Does Python have class prototypes (or forward declarations)? | 524,714 | <p>I have a series of Python classes in a file. Some classes reference others.</p>
<p>My code is something like this:</p>
<pre><code>class A():
pass
class B():
c = C()
class C():
pass
</code></pre>
<p>Trying to run that, I get <code>NameError: name 'C' is not defined</code>. Fair enough, but is there a... | 20 | 2009-02-07T22:21:50Z | 524,726 | <p>This would solve your problem as presented (but I think you are really looking for an instance attribute as jholloway7 responded):</p>
<pre><code>class A:
pass
class B:
pass
class C:
pass
B.c = C()
</code></pre>
| 6 | 2009-02-07T22:30:13Z | [
"python",
"class",
"oop",
"prototype"
] |
Does Python have class prototypes (or forward declarations)? | 524,714 | <p>I have a series of Python classes in a file. Some classes reference others.</p>
<p>My code is something like this:</p>
<pre><code>class A():
pass
class B():
c = C()
class C():
pass
</code></pre>
<p>Trying to run that, I get <code>NameError: name 'C' is not defined</code>. Fair enough, but is there a... | 20 | 2009-02-07T22:21:50Z | 524,801 | <p>All correct answers about class vs instance attributes. However, the reason you have an error is just the order of defining your classes. Of course class C has not yet been defined (as class-level code is executed immediately on import):</p>
<pre><code>class A():
pass
class C():
pass
class B():
c = C(... | 0 | 2009-02-07T23:19:28Z | [
"python",
"class",
"oop",
"prototype"
] |
Does Python have class prototypes (or forward declarations)? | 524,714 | <p>I have a series of Python classes in a file. Some classes reference others.</p>
<p>My code is something like this:</p>
<pre><code>class A():
pass
class B():
c = C()
class C():
pass
</code></pre>
<p>Trying to run that, I get <code>NameError: name 'C' is not defined</code>. Fair enough, but is there a... | 20 | 2009-02-07T22:21:50Z | 525,866 | <p>Python doesn't have prototypes or Ruby-style open classes. But if you really need them, you can write a metaclass that overloads <strong>new</strong> so that it does a lookup in the current namespace to see if the class already exists, and if it does returns the existing type object rather than creating a new one. ... | 2 | 2009-02-08T14:56:03Z | [
"python",
"class",
"oop",
"prototype"
] |
Does Python have class prototypes (or forward declarations)? | 524,714 | <p>I have a series of Python classes in a file. Some classes reference others.</p>
<p>My code is something like this:</p>
<pre><code>class A():
pass
class B():
c = C()
class C():
pass
</code></pre>
<p>Trying to run that, I get <code>NameError: name 'C' is not defined</code>. Fair enough, but is there a... | 20 | 2009-02-07T22:21:50Z | 2,330,235 | <p>Actually, all of the above are great observations about Python, but none of them will solve your problem.</p>
<p>Django needs to introspect stuff.</p>
<p>The <em>right</em> way to do what you want is the following:</p>
<pre><code>class Car(models.Model):
manufacturer = models.ForeignKey('Manufacturer')
# ... | 36 | 2010-02-24T22:45:09Z | [
"python",
"class",
"oop",
"prototype"
] |
python, how to tell what type of obj was returned | 524,734 | <p>How can i find out if the obj returned by a func is a int or something else (like a sqlite cursor)</p>
| 1 | 2009-02-07T22:39:47Z | 524,736 | <p>Use <code>isinstance(item, type)</code> -- for instance:</p>
<pre><code>if isinstance(foo, int):
pass # handle this case
</code></pre>
<p>However, explicit type checking is not considered a good practice in the Python world -- it means that much of the power of duck typing is lost: Something which walks and qu... | 12 | 2009-02-07T22:42:24Z | [
"python",
"types"
] |
python, how to tell what type of obj was returned | 524,734 | <p>How can i find out if the obj returned by a func is a int or something else (like a sqlite cursor)</p>
| 1 | 2009-02-07T22:39:47Z | 524,739 | <p>Use the built-in "type" function, e.g. type(10) -> .</p>
| -1 | 2009-02-07T22:45:43Z | [
"python",
"types"
] |
Python, SQLite and threading | 524,797 | <p>I'm working on an application that will gather data through HTTP from several places, cache the data locally and then serve it through HTTP.</p>
<p>So I was looking at the following. My application will first create several threads that will gather data at a specified interval and cache that data locally into a SQL... | 7 | 2009-02-07T23:18:03Z | 524,806 | <p>Short answer: Don't use Sqlite3 in a threaded application.</p>
<p>Sqlite3 databases scale well for size, but rather terribly for concurrency. You will be plagued with "Database is locked" errors.</p>
<p>If you do, you will need a connection per thread, and you have to ensure that these connections clean up after t... | 7 | 2009-02-07T23:25:02Z | [
"python",
"multithreading",
"sqlite"
] |
Python, SQLite and threading | 524,797 | <p>I'm working on an application that will gather data through HTTP from several places, cache the data locally and then serve it through HTTP.</p>
<p>So I was looking at the following. My application will first create several threads that will gather data at a specified interval and cache that data locally into a SQL... | 7 | 2009-02-07T23:18:03Z | 524,901 | <p>"...create several threads that will gather data at a specified interval and cache that data locally into a sqlite database.
Then in the main thread start a CherryPy app that will query that sqlite db and serve the data."</p>
<p>Don't waste a lot of time on threads. The things you're describing are simply OS proce... | 2 | 2009-02-08T00:54:01Z | [
"python",
"multithreading",
"sqlite"
] |
Python, SQLite and threading | 524,797 | <p>I'm working on an application that will gather data through HTTP from several places, cache the data locally and then serve it through HTTP.</p>
<p>So I was looking at the following. My application will first create several threads that will gather data at a specified interval and cache that data locally into a SQL... | 7 | 2009-02-07T23:18:03Z | 524,937 | <p>Depending on the application the DB could be a real overhead. If we are talking about volatile data, maybe you could skip the communication via DB completely and share the data between the <em>data gathering process</em> and the <em>data serving process(es)</em> via IPC. This is not an option if the data has to be... | 0 | 2009-02-08T01:21:37Z | [
"python",
"multithreading",
"sqlite"
] |
Python, SQLite and threading | 524,797 | <p>I'm working on an application that will gather data through HTTP from several places, cache the data locally and then serve it through HTTP.</p>
<p>So I was looking at the following. My application will first create several threads that will gather data at a specified interval and cache that data locally into a SQL... | 7 | 2009-02-07T23:18:03Z | 524,955 | <p>Depending on the data rate sqlite could be exactly the correct way to do this. The entire database is locked for each write so you aren't going to scale to 1000s of simultaneous writes per second. But if you only have a few it is the safest way of assuring you don't overwrite each other. </p>
| 0 | 2009-02-08T01:33:41Z | [
"python",
"multithreading",
"sqlite"
] |
Python, SQLite and threading | 524,797 | <p>I'm working on an application that will gather data through HTTP from several places, cache the data locally and then serve it through HTTP.</p>
<p>So I was looking at the following. My application will first create several threads that will gather data at a specified interval and cache that data locally into a SQL... | 7 | 2009-02-07T23:18:03Z | 816,571 | <p>You can use something like <a href="http://code.activestate.com/recipes/526618/" rel="nofollow">that</a>.</p>
| 3 | 2009-05-03T08:17:18Z | [
"python",
"multithreading",
"sqlite"
] |
Python's equivalent of $this->$varName | 524,831 | <p>In PHP I can do the following:</p>
<pre><code>$myVar = 'name';
print $myClass->$myVar;
// Identical to $myClass->name
</code></pre>
<p>I wish to do this in Python but can't find out how</p>
| 3 | 2009-02-08T00:17:52Z | 524,842 | <p>In python, it's the getattr built-in function.</p>
<pre><code>class Something( object ):
def __init__( self ):
self.a= 2
self.b= 3
x= Something()
getattr( x, 'a' )
getattr( x, 'b' )
</code></pre>
| 16 | 2009-02-08T00:21:43Z | [
"php",
"python"
] |
Python's equivalent of $this->$varName | 524,831 | <p>In PHP I can do the following:</p>
<pre><code>$myVar = 'name';
print $myClass->$myVar;
// Identical to $myClass->name
</code></pre>
<p>I wish to do this in Python but can't find out how</p>
| 3 | 2009-02-08T00:17:52Z | 524,847 | <p>You'll want to use the getattr builtin function.</p>
<pre><code>myvar = 'name'
//both should produce the same results
value = obj.name
value = getattr(obj, myvar)
</code></pre>
| 5 | 2009-02-08T00:24:51Z | [
"php",
"python"
] |
NumPy, PIL adding an image | 524,930 | <p>I'm trying to add two images together using NumPy and PIL. The way I would do this in <a href="http://en.wikipedia.org/wiki/MATLAB">MATLAB</a> would be something like:</p>
<pre><code>>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res.jpg');
</code></... | 21 | 2009-02-08T01:15:16Z | 524,943 | <p>It seems the code you posted just sums up the values and values bigger than 256 are overflowing. You want something like "(a + b) / 2" or "min(a + b, 256)". The latter seems to be the way that your Matlab example does it.</p>
| 2 | 2009-02-08T01:28:27Z | [
"python",
"image-processing",
"numpy",
"python-imaging-library"
] |
NumPy, PIL adding an image | 524,930 | <p>I'm trying to add two images together using NumPy and PIL. The way I would do this in <a href="http://en.wikipedia.org/wiki/MATLAB">MATLAB</a> would be something like:</p>
<pre><code>>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res.jpg');
</code></... | 21 | 2009-02-08T01:15:16Z | 524,952 | <p>Your sample images are not showing up form me so I am going to do a bit of guessing.</p>
<p>I can't remember exactly how the numpy to pil conversion works but there are two likely cases. I am 95% sure it is 1 but am giving 2 just in case I am wrong.
1) 1 im1Arr is a MxN array of integers (ARGB) and when you add im... | 0 | 2009-02-08T01:32:40Z | [
"python",
"image-processing",
"numpy",
"python-imaging-library"
] |
NumPy, PIL adding an image | 524,930 | <p>I'm trying to add two images together using NumPy and PIL. The way I would do this in <a href="http://en.wikipedia.org/wiki/MATLAB">MATLAB</a> would be something like:</p>
<pre><code>>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res.jpg');
</code></... | 21 | 2009-02-08T01:15:16Z | 525,129 | <p>Using PIL's blend() with an alpha value of 0.5 would be equivalent to (im1arr + im2arr)/2. Blend does not require that the images have alpha layers.</p>
<p>Try this:</p>
<pre><code>from PIL import Image
im1 = Image.open('/Users/rem7/Desktop/_1.jpg')
im2 = Image.open('/Users/rem7/Desktop/_2.jpg')
Image.blend(im1,... | 16 | 2009-02-08T03:58:33Z | [
"python",
"image-processing",
"numpy",
"python-imaging-library"
] |
NumPy, PIL adding an image | 524,930 | <p>I'm trying to add two images together using NumPy and PIL. The way I would do this in <a href="http://en.wikipedia.org/wiki/MATLAB">MATLAB</a> would be something like:</p>
<pre><code>>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res.jpg');
</code></... | 21 | 2009-02-08T01:15:16Z | 525,476 | <p>To clamp numpy array values:</p>
<pre><code>>>> c = a + b
>>> c[c > 256] = 256
</code></pre>
| 1 | 2009-02-08T09:54:53Z | [
"python",
"image-processing",
"numpy",
"python-imaging-library"
] |
NumPy, PIL adding an image | 524,930 | <p>I'm trying to add two images together using NumPy and PIL. The way I would do this in <a href="http://en.wikipedia.org/wiki/MATLAB">MATLAB</a> would be something like:</p>
<pre><code>>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res.jpg');
</code></... | 21 | 2009-02-08T01:15:16Z | 526,031 | <p>As everyone suggested already, the weird colors you're observing are overflow. And as you point out in the <a href="http://stackoverflow.com/questions/524930/numpy-pil-adding-an-image/524943#524943">comment of schnaader's answer</a> you <strong>still get overflow</strong> if you add your images like this:</p>
<pre>... | 27 | 2009-02-08T17:05:45Z | [
"python",
"image-processing",
"numpy",
"python-imaging-library"
] |
Django templates: create a "back" link? | 524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view function, and pass it al... | 11 | 2009-02-08T02:02:04Z | 525,000 | <p>Well you can enable:</p>
<pre><code>'django.core.context_processors.request',
</code></pre>
<p>in your <code>settings.TEMPLATE_CONTEXT_PROCESSORS</code> block and hook out the referrer but that's a bit nauseating and could break all over the place. </p>
<p>Most places where you'd want this (eg the edit post page ... | 10 | 2009-02-08T02:08:27Z | [
"python",
"django",
"request",
"referrer"
] |
Django templates: create a "back" link? | 524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view function, and pass it al... | 11 | 2009-02-08T02:02:04Z | 657,757 | <p>You can always use the client side option which is very simple:</p>
<pre><code><a href="javascript:history.go(1)">Back</a>
</code></pre>
| 0 | 2009-03-18T10:50:13Z | [
"python",
"django",
"request",
"referrer"
] |
Django templates: create a "back" link? | 524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view function, and pass it al... | 11 | 2009-02-08T02:02:04Z | 666,407 | <p>actually it's go(-1)</p>
<p><
input type=button value="Previous Page" onClick="javascript:history.go(-1);"></p>
| 16 | 2009-03-20T14:33:04Z | [
"python",
"django",
"request",
"referrer"
] |
Django templates: create a "back" link? | 524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view function, and pass it al... | 11 | 2009-02-08T02:02:04Z | 26,867,597 | <p>This solution worked out for me:</p>
<pre><code><a href="{{request.META.HTTP_REFERER}}">Go back</a>
</code></pre>
<p>But that's previously adding <code>'django.core.context_processors.request',</code> to <code>TEMPLATE_CONTEXT_PROCESSORS</code> in your project's settings.</p>
| 10 | 2014-11-11T14:49:38Z | [
"python",
"django",
"request",
"referrer"
] |
Django templates: create a "back" link? | 524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view function, and pass it al... | 11 | 2009-02-08T02:02:04Z | 38,895,097 | <p>For a 'back' button in change forms for Django admin what I end up doing is a custom template filter to parse and decode the 'preserved_filters' variable in the template. I placed the following on a customized templates/admin/submit_line.html file:</p>
<pre><code><a href="../{% if original}../{% endif %}?{{ pres... | 0 | 2016-08-11T11:27:15Z | [
"python",
"django",
"request",
"referrer"
] |
Django templates: create a "back" link? | 524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view function, and pass it al... | 11 | 2009-02-08T02:02:04Z | 39,746,102 | <p>Using client side solution would be the proper solution.</p>
<pre><code><a href="javascript:history.go(-1)" class="btn btn-default">Cancel</a>
</code></pre>
| 0 | 2016-09-28T11:26:03Z | [
"python",
"django",
"request",
"referrer"
] |
Is there an alternative to rexec for Python sandboxing? | 525,056 | <p>Implementing a 'sandbox' environment in Python used to be done with the rexec module (<a href="http://docs.python.org/library/rexec.html">http://docs.python.org/library/rexec.html</a>). Unfortunately, it has been deprecated/removed due to some security vulnerabilities. Is there an alternative?</p>
<p>My goal is t... | 5 | 2009-02-08T02:51:32Z | 525,091 | <p>You might want to provide your own <code>__import__</code> to prevent inclusion of any modules you deem "abuse I/O or processor/memory resources."</p>
<p>You might want to start with <a href="http://codespeak.net/pypy/dist/pypy/doc/" rel="nofollow">pypy</a> and create your own interpreter with limitations and cons... | 4 | 2009-02-08T03:18:33Z | [
"python",
"security",
"sandbox",
"rexec"
] |
Is there an alternative to rexec for Python sandboxing? | 525,056 | <p>Implementing a 'sandbox' environment in Python used to be done with the rexec module (<a href="http://docs.python.org/library/rexec.html">http://docs.python.org/library/rexec.html</a>). Unfortunately, it has been deprecated/removed due to some security vulnerabilities. Is there an alternative?</p>
<p>My goal is t... | 5 | 2009-02-08T02:51:32Z | 525,472 | <p>in cpython "sandboxing" for security reasons is a:
<strong>"<em>don't do that at your company kids</em>"-thing</strong>.</p>
<p>try :</p>
<ul>
<li>jython with java "sandboxing"</li>
<li>pypy -> see Answer S.Lott</li>
<li>maybe ironpython has a solution ?</li>
</ul>
<p>see <a href="http://www.wingware.com/psuppor... | 2 | 2009-02-08T09:51:57Z | [
"python",
"security",
"sandbox",
"rexec"
] |
python coding speed and cleanest | 525,080 | <p>Python is pretty clean, and I can code neat apps quickly.
But I notice I have some minor error someplace and I dont find the error at compile but at run time. Then I need to change and run the script again. Is there a way to have it break and let me modify and run?</p>
<p>Also, I dislike how python has no enums. If... | 0 | 2009-02-08T03:14:04Z | 525,099 | <p><strong>"I don't find the error at compile but at run time"</strong></p>
<p>Correct. True for all non-compiled interpreted languages.</p>
<p><strong>"I need to change and run the script again"</strong></p>
<p>Also correct. True for all non-compiled interpreted languages.</p>
<p><strong>"Is there a way to have ... | 9 | 2009-02-08T03:25:30Z | [
"python"
] |
python coding speed and cleanest | 525,080 | <p>Python is pretty clean, and I can code neat apps quickly.
But I notice I have some minor error someplace and I dont find the error at compile but at run time. Then I need to change and run the script again. Is there a way to have it break and let me modify and run?</p>
<p>Also, I dislike how python has no enums. If... | 0 | 2009-02-08T03:14:04Z | 525,106 | <p>Python is an interpreted language, there <em>is</em> no compile stage, at least not that is visible to the user. If you get an error, go back, modify the script, and try again. If your script has long execution time, and you don't want to stop-restart, you can try a debugger like pdb, using which you can fix some of... | 2 | 2009-02-08T03:28:24Z | [
"python"
] |
python coding speed and cleanest | 525,080 | <p>Python is pretty clean, and I can code neat apps quickly.
But I notice I have some minor error someplace and I dont find the error at compile but at run time. Then I need to change and run the script again. Is there a way to have it break and let me modify and run?</p>
<p>Also, I dislike how python has no enums. If... | 0 | 2009-02-08T03:14:04Z | 525,135 | <p>With interpreted languages you have a lot of freedom. Freedom isn't free here either. While the interpreter won't torture you into dotting every i and crossing every T before it deems your code worthy of a run, it also won't try to statically analyze your code for all those problems. So you have a few choices.</p... | 3 | 2009-02-08T04:05:03Z | [
"python"
] |
python coding speed and cleanest | 525,080 | <p>Python is pretty clean, and I can code neat apps quickly.
But I notice I have some minor error someplace and I dont find the error at compile but at run time. Then I need to change and run the script again. Is there a way to have it break and let me modify and run?</p>
<p>Also, I dislike how python has no enums. If... | 0 | 2009-02-08T03:14:04Z | 525,196 | <p>You might want to look into something like <a href="http://jeffwinkler.net/2006/04/27/keeping-your-nose-green/" rel="nofollow">nosey</a>, which runs your unit tests periodically when you've saved changes to a file. You could also set up a save-event trigger to run your unit tests in the background whenever you save ... | 3 | 2009-02-08T05:24:30Z | [
"python"
] |
pycurl and unescape | 525,244 | <p>curl_unescape doesnt seem to be in pycurl, what do i use instead?</p>
| 2 | 2009-02-08T06:08:00Z | 525,271 | <p>Have you tried <code>urllib.quote</code>?</p>
<pre><code>import urllib
print urllib.quote("some url")
some%20url
</code></pre>
<p><a href="http://docs.python.org/library/urllib.html">here's</a> the documentation</p>
| 5 | 2009-02-08T06:34:39Z | [
"python",
"pycurl"
] |
pycurl and unescape | 525,244 | <p>curl_unescape doesnt seem to be in pycurl, what do i use instead?</p>
| 2 | 2009-02-08T06:08:00Z | 525,508 | <p><a
href="http://curl.haxx.se/libcurl/c/curl_unescape.html"> curl_ unescape </a>
is an obsolete function. Use <a href="http://curl.haxx.se/libcurl/c/curl_easy_unescape.html" rel="nofollow"> curl_ easy_unescape </a>
instead.</p>
| 2 | 2009-02-08T10:30:13Z | [
"python",
"pycurl"
] |
pycurl and unescape | 525,244 | <p>curl_unescape doesnt seem to be in pycurl, what do i use instead?</p>
| 2 | 2009-02-08T06:08:00Z | 9,639,360 | <p>We are planning to release new version of pycURL in a month or two. The new version would have all features of libcurl installed on your machine. -:)</p>
| 0 | 2012-03-09T18:46:46Z | [
"python",
"pycurl"
] |
Python truncate lines as they are read | 525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | 7 | 2009-02-08T06:34:52Z | 525,287 | <p>Truncating the file as you read it seems a bit extreme. What if your script has a bug that doesn't cause an error? In that case you'll want to restart at the beginning of your file.</p>
<p>How about having your script print the line number it breaks on and having it take a line number as a parameter so you can tell... | 4 | 2009-02-08T06:47:38Z | [
"python",
"file-io"
] |
Python truncate lines as they are read | 525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | 7 | 2009-02-08T06:34:52Z | 525,296 | <p>First of all, calling the operation <code>truncate</code> is probably not the best pick. If I understand the problem correctly, you want to delete everything up to the current position in file. (I would expect <code>truncate</code> to cut everything from the current position up to the end of the file. This is how th... | 4 | 2009-02-08T06:54:25Z | [
"python",
"file-io"
] |
Python truncate lines as they are read | 525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | 7 | 2009-02-08T06:34:52Z | 525,299 | <p>You're better off keeping a index into the file so that you can start where you stopped last, without destroying part of the file. Something like this would work :</p>
<pre><code>try :
for index, line in enumerate(file) :
processLine(line)
except :
# Failed, start from this line number next time.
... | 6 | 2009-02-08T06:55:36Z | [
"python",
"file-io"
] |
Python truncate lines as they are read | 525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | 7 | 2009-02-08T06:34:52Z | 525,312 | <h3>Remove all lines after you've done with them:</h3>
<pre><code>with open('myfile.txt', 'rw+') as file:
for line in file:
processLine(line)
file.truncate(0)
</code></pre>
<h3>Remove each line independently:</h3>
<pre><code>lines = open('myfile.txt').readlines()
for i, line in enumerate(lines[:]):
... | 13 | 2009-02-08T07:08:14Z | [
"python",
"file-io"
] |
Python truncate lines as they are read | 525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | 7 | 2009-02-08T06:34:52Z | 525,454 | <p><strong>You can't</strong>. It is just not possible with actual text file implementations on current filesystems.</p>
<p>Text files are sequential, because the lines in a text file can be of any length.
Deleting a particular line would mean rewriting the entire file from that point on.</p>
<p>Suppose you have a fi... | 8 | 2009-02-08T09:25:03Z | [
"python",
"file-io"
] |
Python truncate lines as they are read | 525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | 7 | 2009-02-08T06:34:52Z | 2,827,323 | <p>A related post has what seems a good strategy to do that, see
<a href="http://stackoverflow.com/questions/366533/how-can-i-run-the-first-process-from-a-list-of-processes-stored-in-a-file-and-imm/366604#366604">http://stackoverflow.com/questions/366533/how-can-i-run-the-first-process-from-a-list-of-processes-stored-... | 2 | 2010-05-13T13:56:53Z | [
"python",
"file-io"
] |
Embedding icon in .exe with py2exe, visible in Vista? | 525,329 | <p>I've been trying to embed an icon (.ico) into my "compyled" .exe with py2exe.</p>
<p>Py2Exe does have a way to embed an icon:</p>
<pre><code>windows=[{
'script':'MyScript.py',
'icon_resources':[(1,'MyIcon.ico')]
}]
</code></pre>
<p>And that's what I am using. The icon shows up fine on Windows XP or lower,... | 15 | 2009-02-08T07:26:06Z | 525,486 | <p>Vista uses icons of high resolution <em>256x256</em> pixels images, they are stored using <em>PNG-based</em> compression. The problem is if you simply make the icon and save it in standard XP <code>ICO</code> format, the resulting file will be <code>400Kb</code> on disk. The solution is to compress the images. The c... | 19 | 2009-02-08T10:06:26Z | [
"python",
"windows-vista",
"embed",
"icons",
"py2exe"
] |
Embedding icon in .exe with py2exe, visible in Vista? | 525,329 | <p>I've been trying to embed an icon (.ico) into my "compyled" .exe with py2exe.</p>
<p>Py2Exe does have a way to embed an icon:</p>
<pre><code>windows=[{
'script':'MyScript.py',
'icon_resources':[(1,'MyIcon.ico')]
}]
</code></pre>
<p>And that's what I am using. The icon shows up fine on Windows XP or lower,... | 15 | 2009-02-08T07:26:06Z | 6,198,910 | <p>It seems that the order of icon sizes is the key, as said by Helmut.
To invert the pages (larger ones first) solves the issue on Windows 7 for 'include_resources' (using Py2exe 0.6.9).</p>
| 3 | 2011-06-01T09:21:52Z | [
"python",
"windows-vista",
"embed",
"icons",
"py2exe"
] |
Embedding icon in .exe with py2exe, visible in Vista? | 525,329 | <p>I've been trying to embed an icon (.ico) into my "compyled" .exe with py2exe.</p>
<p>Py2Exe does have a way to embed an icon:</p>
<pre><code>windows=[{
'script':'MyScript.py',
'icon_resources':[(1,'MyIcon.ico')]
}]
</code></pre>
<p>And that's what I am using. The icon shows up fine on Windows XP or lower,... | 15 | 2009-02-08T07:26:06Z | 9,072,420 | <p>The link to the Greenfish Iceon Editor Pro is broken.
I scanned the net and found <a href="http://icofx.ro/downloads.html" rel="nofollow">Download IcoFX</a>
Used the IcoFX program on my .exe file and could see that indeed it contained my icon. </p>
<p>Using the menu Image->Create Windows Icons from Image, and the... | 3 | 2012-01-30T23:38:49Z | [
"python",
"windows-vista",
"embed",
"icons",
"py2exe"
] |
Embedding icon in .exe with py2exe, visible in Vista? | 525,329 | <p>I've been trying to embed an icon (.ico) into my "compyled" .exe with py2exe.</p>
<p>Py2Exe does have a way to embed an icon:</p>
<pre><code>windows=[{
'script':'MyScript.py',
'icon_resources':[(1,'MyIcon.ico')]
}]
</code></pre>
<p>And that's what I am using. The icon shows up fine on Windows XP or lower,... | 15 | 2009-02-08T07:26:06Z | 10,404,866 | <p>I was having problems with embedding the icon resource with py2exe on Windows7 using a .ico file containing a 32x32 pixel image. I was using the same method as the original question.</p>
<p>Once compiled the icon on the exe disappears. On investigation the icon is added at index 0, according to the <a href="http://... | 2 | 2012-05-01T21:49:00Z | [
"python",
"windows-vista",
"embed",
"icons",
"py2exe"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.