title
stringlengths
10
172
question_id
int64
469
40.1M
question_body
stringlengths
22
48.2k
question_score
int64
-44
5.52k
question_date
stringlengths
20
20
answer_id
int64
497
40.1M
answer_body
stringlengths
18
33.9k
answer_score
int64
-38
8.38k
answer_date
stringlengths
20
20
tags
listlengths
1
5
Pylons: address already in use when trying to serve
1,071,071
<p>I'm running pylons and I did this: paster server development.ini It's running on :5000</p> <p>But when I try to run the command again: paster serve development.ini</p> <p>I get this message: socket.error: [Errno 98] Address already in use</p> <p>Any ideas?</p>
3
2009-07-01T20:03:07Z
16,368,876
<p>naturally <code>netstat</code> (<code>netstat -an | grep 5000</code> does the trick on linux). Will grab the port</p> <p>However I found this other question with the same error. </p> <p><a href="http://stackoverflow.com/questions/4465959/python-errno-98-address-already-in-use/4466035#4466035">Python [Errno 98] Add...
0
2013-05-03T23:17:04Z
[ "python", "nginx", "pylons", "paste", "paster" ]
Pylons: address already in use when trying to serve
1,071,071
<p>I'm running pylons and I did this: paster server development.ini It's running on :5000</p> <p>But when I try to run the command again: paster serve development.ini</p> <p>I get this message: socket.error: [Errno 98] Address already in use</p> <p>Any ideas?</p>
3
2009-07-01T20:03:07Z
30,009,931
<p>I tried all the upvoted answers exists here but no one works for me. But this below command does the trick.</p> <pre><code>sudo kill $(sudo lsof -t -i:5000) </code></pre> <p>This would kill the process which listens on the port <code>5000</code>.</p>
0
2015-05-03T03:31:37Z
[ "python", "nginx", "pylons", "paste", "paster" ]
Deploying Pylons with Nginx reverse proxy?
1,071,088
<p>Is there a tutorial on how to deploy Pylons with Nginx?</p> <p>I've been able to start nginx and then serve pylons to :8080 with paster serve development.ini</p> <p>However, I can't seem to do other stuff as pylons locks me into that serve mode. If I try to CTRL+Z out of pylons serving to do other stuff on my ser...
1
2009-07-01T20:06:12Z
1,071,185
<p>Run Pylons in daemon mode.</p> <pre><code>paster serve development.ini --daemon </code></pre>
5
2009-07-01T20:21:43Z
[ "python", "nginx", "pylons", "paster" ]
Deploying Pylons with Nginx reverse proxy?
1,071,088
<p>Is there a tutorial on how to deploy Pylons with Nginx?</p> <p>I've been able to start nginx and then serve pylons to :8080 with paster serve development.ini</p> <p>However, I can't seem to do other stuff as pylons locks me into that serve mode. If I try to CTRL+Z out of pylons serving to do other stuff on my ser...
1
2009-07-01T20:06:12Z
2,016,256
<p>Running Pylons with nginx tutorial found here: wiki.pylonshq.com/display/pylonscookbook/Running+Pylons+with+NGINX</p> <p>Pylons on Nginx with Memcached and SSI: <a href="http://www.reshetseret.com/app/blog/?p=3" rel="nofollow">http://www.reshetseret.com/app/blog/?p=3</a></p> <p>UPDATE: link is broken, here is goog...
2
2010-01-06T21:09:32Z
[ "python", "nginx", "pylons", "paster" ]
Call Google Translate from Python
1,071,110
<p>I want to execute <a href="http://code.google.com/apis/ajaxlanguage/documentation/translate.html" rel="nofollow">this script (view source)</a> that uses Google Translate AJAX API from python, and be able to pass arguments and get the answer back. I don't care about the HTML.</p> <p>I understand I need to embed a J...
4
2009-07-01T20:10:21Z
1,071,150
<p>You can use the RESTful API instead. It's designed for environments that are not Javascript.</p> <p><a href="http://code.google.com/apis/ajaxlanguage/documentation/reference.html#_intro_fonje" rel="nofollow">http://code.google.com/apis/ajaxlanguage/documentation/reference.html#_intro_fonje</a></p> <p>That should b...
3
2009-07-01T20:18:17Z
[ "python", "ajax" ]
Call Google Translate from Python
1,071,110
<p>I want to execute <a href="http://code.google.com/apis/ajaxlanguage/documentation/translate.html" rel="nofollow">this script (view source)</a> that uses Google Translate AJAX API from python, and be able to pass arguments and get the answer back. I don't care about the HTML.</p> <p>I understand I need to embed a J...
4
2009-07-01T20:10:21Z
1,071,161
<p>You can use <a href="http://googletranslate.sourceforge.net/" rel="nofollow">google-api-translate-python</a> to talk to google api.</p> <p><strong>EDIT:</strong> It wasn't clear where the sources are, found them <a href="https://googletranslate.svn.sourceforge.net/svnroot/googletranslate/src/trunk/" rel="nofollow">...
3
2009-07-01T20:19:39Z
[ "python", "ajax" ]
Call Google Translate from Python
1,071,110
<p>I want to execute <a href="http://code.google.com/apis/ajaxlanguage/documentation/translate.html" rel="nofollow">this script (view source)</a> that uses Google Translate AJAX API from python, and be able to pass arguments and get the answer back. I don't care about the HTML.</p> <p>I understand I need to embed a J...
4
2009-07-01T20:10:21Z
18,106,223
<p>Had to do this recently, and since I had to translate long strings, I couldn't use URL parameters, but rather use a data payload. Thought this is the best place to share this solution.<br> The trick basically is to use Python's excellent Requests module post, but since google require a GET request, use the 'X-HTTP-M...
1
2013-08-07T14:33:35Z
[ "python", "ajax" ]
Detect URLs in a string and wrap with "<a href..." tag
1,071,191
<p>I am looking to write something that seems like it should be easy enough, but for whatever reason I'm having a tough time getting my head around it.</p> <p>I am looking to write a python function that, when passed a string, will pass that string back with HTML encoding around URLs.</p> <pre><code>unencoded_string ...
6
2009-07-01T20:22:25Z
1,071,240
<p>Googled solutions:</p> <pre><code>#---------- find_urls.py----------# # Functions to identify and extract URLs and email addresses import re def fix_urls(text): pat_url = re.compile( r''' (?x)( # verbose identify URLs within text (http|ftp|gopher) # make sure we find a resource ...
5
2009-07-01T20:31:17Z
[ "python", "html", "regex" ]
Detect URLs in a string and wrap with "<a href..." tag
1,071,191
<p>I am looking to write something that seems like it should be easy enough, but for whatever reason I'm having a tough time getting my head around it.</p> <p>I am looking to write a python function that, when passed a string, will pass that string back with HTML encoding around URLs.</p> <pre><code>unencoded_string ...
6
2009-07-01T20:22:25Z
1,071,294
<p>The "regex magic" you need is just <code>sub</code> (which does a substitution):</p> <pre><code>def encode_string_with_links(unencoded_string): return URL_REGEX.sub(r'&lt;a href="\1"&gt;\1&lt;/a&gt;', unencoded_string) </code></pre> <p><code>URL_REGEX</code> could be something like:</p> <pre><code>URL_REGEX = r...
7
2009-07-01T20:42:08Z
[ "python", "html", "regex" ]
Why does list comprehension using a zip object results in an empty list?
1,071,201
<pre><code>f = lambda x : 2*x g = lambda x : x ** 2 h = lambda x : x ** x funcTriple = ( f, g, h ) myZip = ( zip ( funcTriple, (1, 3, 5) ) ) k = lambda pair : pair[0](pair[1]) # Why do Output # 1 (2, 9, 3125) and Output # 2 ( [ ] ) differ? print ("\n\nOutput # 1: for pair in myZip: k(pair) ...") for pair in myZip : ...
6
2009-07-01T20:24:37Z
1,071,239
<p>Works perfectly in Python 2.6 but fails in Python 3.0 because <code>zip</code> returns a generator-style object and the first loop exhausts it. Make a list instead:</p> <pre><code>myZip = list( zip ( funcTriple, (1, 3, 5) ) ) </code></pre> <p>and it works in Python 3.0</p>
17
2009-07-01T20:31:16Z
[ "python", "zip", "list-comprehension" ]
Form Initialization with ToscaWidgets
1,071,277
<p><strong>Question:</strong></p> <p>How do I prefill a CheckBoxTable from ToscaWidgets with values.</p> <p><strong>Background:</strong></p> <p>I've looked everywhere and I can't seem to figure out how to initialize a particular form field with ToscaWidgets. Most form fields seem to respond just fine to initializat...
3
2009-07-01T20:39:06Z
1,073,935
<p>set them via the value param. </p> <pre><code>import tw.forms f = tw.forms.TableForm(fields=[tw.forms.CheckBoxTable("name",options=(("foo"),("bar")))]) f(value={"name":{"foo":True,"bar":False}}) &gt;&gt;&gt; u'&lt;form xmlns="http://www.w3.org/1999/xhtml" action="" method="post" class="tableform"&gt;\n &lt;tabl...
1
2009-07-02T11:52:58Z
[ "python", "forms", "turbogears", "mako", "toscawidgets" ]
Does anyone know of source code for a web based study group?
1,071,433
<p>I'm looking for source code for a web based study group. I'd prefer something in Python or C#. I have searched google but I'm finding mostly existing study groups on particular topics and not software to host an online study group. </p> <p>Can anyone help out?</p> <p><hr /></p> <p>Edit: Ah, I was unfamiliar with ...
2
2009-07-01T21:15:27Z
1,071,455
<p>I am not quite sure what you mean by "host an online study group".</p> <p>If it is about people collaborate to learn something, I think <a href="http://moodle.org/" rel="nofollow">moodle</a> is what you are looking for.</p> <p>Here is the <a href="http://en.wikipedia.org/wiki/Moodle" rel="nofollow">wikipedia lemma...
4
2009-07-01T21:20:27Z
[ "c#", "python" ]
Does anyone know of source code for a web based study group?
1,071,433
<p>I'm looking for source code for a web based study group. I'd prefer something in Python or C#. I have searched google but I'm finding mostly existing study groups on particular topics and not software to host an online study group. </p> <p>Can anyone help out?</p> <p><hr /></p> <p>Edit: Ah, I was unfamiliar with ...
2
2009-07-01T21:15:27Z
1,075,093
<p>There seems to be work on a django based course MS - <a href="http://peach3.nl/trac" rel="nofollow">http://peach3.nl/trac</a> . However, the source is not available yet :(</p> <p>I am interested in developping such an app (free open-source) in django (which I am learning), so if anybody else wants to help email me ...
0
2009-07-02T15:34:02Z
[ "c#", "python" ]
python class variable not visible in __init__?
1,071,469
<p>This code produces an error message, which I found surprising:</p> <pre><code>class Foo(object): custom = 1 def __init__(self, custom=Foo.custom): self._custom = custom x = Foo() </code></pre> <p>Can anyone provide enlightenment?</p>
5
2009-07-01T21:25:34Z
1,071,485
<p>The class body is executed before the class its self is defined, so default argument values can't reference the class. Just making <code>custom</code> the default (without class qualification) should work.</p>
3
2009-07-01T21:29:34Z
[ "python" ]
python class variable not visible in __init__?
1,071,469
<p>This code produces an error message, which I found surprising:</p> <pre><code>class Foo(object): custom = 1 def __init__(self, custom=Foo.custom): self._custom = custom x = Foo() </code></pre> <p>Can anyone provide enlightenment?</p>
5
2009-07-01T21:25:34Z
1,071,491
<p>It's <code>Foo</code> that isn't visible, because you're in the middle of building it. But since you're in the same scope as <code>custom</code>, you can just say <code>custom</code> rather than <code>Foo.custom</code>:</p> <pre><code>class Foo(object): custom = 1 def __init__(self, mycustom=custom): ...
11
2009-07-01T21:30:21Z
[ "python" ]
python class variable not visible in __init__?
1,071,469
<p>This code produces an error message, which I found surprising:</p> <pre><code>class Foo(object): custom = 1 def __init__(self, custom=Foo.custom): self._custom = custom x = Foo() </code></pre> <p>Can anyone provide enlightenment?</p>
5
2009-07-01T21:25:34Z
1,071,494
<p>I get the following error:</p> <pre><code>Traceback (most recent call last): Line 1, in &lt;module&gt; class Foo(object): Line 3, in Foo def __init__(self, custom=Foo.custom): NameError: name 'Foo' is not defined </code></pre> <p>This is because the name <code>Foo</code> is in the process of being defi...
2
2009-07-01T21:30:47Z
[ "python" ]
python class variable not visible in __init__?
1,071,469
<p>This code produces an error message, which I found surprising:</p> <pre><code>class Foo(object): custom = 1 def __init__(self, custom=Foo.custom): self._custom = custom x = Foo() </code></pre> <p>Can anyone provide enlightenment?</p>
5
2009-07-01T21:25:34Z
1,071,498
<p>What we do instead is the following</p> <pre><code>class Foo( object ): custom = 1 def __init__( self, arg=None ) self._custom = self.custom if arg is None else arg </code></pre> <p>This bypasses the confusing issue of whether or not the name <code>Foo</code> has been defined yet.</p>
6
2009-07-01T21:32:27Z
[ "python" ]
Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?
1,071,667
<p>I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter.</p> <p>I have the <a href="http://www.tachyonsoft.co...
-1
2009-07-01T22:27:56Z
1,071,694
<p>If you set up the table correctly, then you just need to do:</p> <pre><code>translated_chars = ebcdic.translate(EBCDIC_TO_LATIN1) </code></pre> <p>where <code>ebcdic</code> contains EBCDIC characters and <code>EBCDIC_TO_LATIN1</code> is a 256-char string which maps each EBCDIC character to its Latin-1 equivalent. ...
1
2009-07-01T22:36:43Z
[ "python", "ebcdic" ]
Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?
1,071,667
<p>I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter.</p> <p>I have the <a href="http://www.tachyonsoft.co...
-1
2009-07-01T22:27:56Z
1,071,735
<p>EBCDIC 500, aka Code Page 500, is amongst Pythons encodings, although you link to cp1047, which doesn't. Which one are you using, really? Anyway this works for cp500 (or any other encoding that you have).</p> <pre><code>from __future__ import with_statement import sys from contextlib import nested BUFFER_SIZE = 16...
3
2009-07-01T22:54:54Z
[ "python", "ebcdic" ]
Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?
1,071,667
<p>I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter.</p> <p>I have the <a href="http://www.tachyonsoft.co...
-1
2009-07-01T22:27:56Z
1,072,049
<p>Assuming cp500 contains all of your "additional propietary characters", a more concise version based on Lennart's answer using the <code>codecs</code> module:</p> <pre><code>import sys, codecs BUFFER_SIZE = 64*1024 ebd_file = codecs.open(sys.argv[1], 'r', 'cp500') latin1_file = codecs.open(sys.argv[2], 'w', 'latin...
-2
2009-07-02T01:03:26Z
[ "python", "ebcdic" ]
Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?
1,071,667
<p>I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter.</p> <p>I have the <a href="http://www.tachyonsoft.co...
-1
2009-07-01T22:27:56Z
1,072,347
<p>Answer 1:</p> <p>Yet another silly question: What gave you the impression that recode produced only ASCII as output? AFAICT it will transcode ANY of its repertoire of charsets to ANY of its repertoire, AND its repertoire includes IBM cp500 and cp1047, and OF COURSE latin1. Reading the comments, you will note that L...
0
2009-07-02T03:39:20Z
[ "python", "ebcdic" ]
Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?
1,071,667
<p>I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter.</p> <p>I have the <a href="http://www.tachyonsoft.co...
-1
2009-07-01T22:27:56Z
1,075,257
<p>No crystal ball, no info from OP, so had a bit of a rummage in the EPO website. Found freely downloadable weekly patent info files, still available in cp500/SGML even though website says this to be replaced by utf8/XML in 2006 :-). Got the 2009 week 27 file. Is a zip containing 2 files s350927[ab].bin. "bin" means "...
0
2009-07-02T16:07:48Z
[ "python", "ebcdic" ]
Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?
1,071,667
<p>I have to convert a number of large files (up to 2GB) of EBCDIC 500 encoded files to Latin-1. Since I could only find EBCDIC to ASCII converters (dd, recode) and the files contain some additional proprietary character codes, I thought I'd write my own converter.</p> <p>I have the <a href="http://www.tachyonsoft.co...
-1
2009-07-01T22:27:56Z
37,647,699
<p>While this might not help the original poster anymore, some time ago I released a package for Python 2.6+ and 3.2+ that adds most of the western 8 bit mainframe codecs including CP1047 (French) and CP1141 (German): <a href="https://pypi.python.org/pypi/ebcdic" rel="nofollow">https://pypi.python.org/pypi/ebcdic</a>. ...
0
2016-06-05T23:13:49Z
[ "python", "ebcdic" ]
I need a Python class that keep tracks of how many times it is instantiated
1,071,935
<p>I need a class that works like this:</p> <pre><code>&gt;&gt;&gt; a=Foo() &gt;&gt;&gt; b=Foo() &gt;&gt;&gt; c=Foo() &gt;&gt;&gt; c.i 3 </code></pre> <p>Here is my try:</p> <pre><code>class Foo(object): i = 0 def __init__(self): Foo.i += 1 </code></pre> <p>It works as required, but I wonder if ther...
4
2009-07-02T00:12:36Z
1,071,939
<p>Nope. That's pretty good.</p> <p>From The Zen of Python: "Simple is better than complex."</p> <p>That works fine and is clear on what you're doing, don't complicate it. Maybe name it <code>counter</code> or something, but other than that you're good to go as far as pythonic goes.</p>
11
2009-07-02T00:14:04Z
[ "python", "class", "instances" ]
I need a Python class that keep tracks of how many times it is instantiated
1,071,935
<p>I need a class that works like this:</p> <pre><code>&gt;&gt;&gt; a=Foo() &gt;&gt;&gt; b=Foo() &gt;&gt;&gt; c=Foo() &gt;&gt;&gt; c.i 3 </code></pre> <p>Here is my try:</p> <pre><code>class Foo(object): i = 0 def __init__(self): Foo.i += 1 </code></pre> <p>It works as required, but I wonder if ther...
4
2009-07-02T00:12:36Z
1,072,061
<p>Abuse of decorators and metaclasses.</p> <pre><code>def counting(cls): class MetaClass(getattr(cls, '__class__', type)): __counter = 0 def __new__(meta, name, bases, attrs): old_init = attrs.get('__init__') def __init__(*args, **kwargs): MetaClass.__counte...
5
2009-07-02T01:48:41Z
[ "python", "class", "instances" ]
I need a Python class that keep tracks of how many times it is instantiated
1,071,935
<p>I need a class that works like this:</p> <pre><code>&gt;&gt;&gt; a=Foo() &gt;&gt;&gt; b=Foo() &gt;&gt;&gt; c=Foo() &gt;&gt;&gt; c.i 3 </code></pre> <p>Here is my try:</p> <pre><code>class Foo(object): i = 0 def __init__(self): Foo.i += 1 </code></pre> <p>It works as required, but I wonder if ther...
4
2009-07-02T00:12:36Z
1,074,252
<p>If you want to worry about thread safety (so that the class variable can be modified from multiple threads that are instantiating <code>Foo</code>s), the above answer is in correct. I asked this question about thread safety <a href="http://stackoverflow.com/questions/1072821/is-modifying-a-class-variable-in-python-t...
4
2009-07-02T13:10:47Z
[ "python", "class", "instances" ]
How do I satisfy a 3rd-party shared library reference to stat when I'm creating a shared library shim rather than an executable?
1,072,068
<p>I am the new maintainer for an in-house Python system that uses a set of 3rd-party shared C libraries via a shared library shim that is created using a combination of swig and a setup.py script. This has been working well until recently.</p> <p>The 3rd-party shared C libraries were updated for new functionality and...
1
2009-07-02T01:58:55Z
1,094,520
<p>The solution was to create to a new Centos 5.3 VM and re-build and/or re-install components as needed.</p>
1
2009-07-07T20:00:40Z
[ "python", "c", "swig" ]
How do I satisfy a 3rd-party shared library reference to stat when I'm creating a shared library shim rather than an executable?
1,072,068
<p>I am the new maintainer for an in-house Python system that uses a set of 3rd-party shared C libraries via a shared library shim that is created using a combination of swig and a setup.py script. This has been working well until recently.</p> <p>The 3rd-party shared C libraries were updated for new functionality and...
1
2009-07-02T01:58:55Z
1,122,516
<p>As it turns out, while moving to Centos 5.3 was probably a good thing in the long run, the actual problem turns out to have been the way that libz4lnx was built on the DVD that I was originally using. In the process of moving to Centos 5.3, I also moved to a newer build of the libz4lnx library. Today, while testing ...
1
2009-07-13T22:47:46Z
[ "python", "c", "swig" ]
Is this a correct way to return JSON in Python/GAE for parsing in JavaScript?
1,072,281
<p>I am making an API for some AJAX related things in my web app on GAE in Python. After setting the content-type to 'application/json' and accessing my url directly-</p> <pre><code>http://mysite.com/api?method=theMethod&amp;param=firstParam </code></pre> <p>-I am being prompted with a 'save file' dialog box instead ...
2
2009-07-02T03:15:11Z
1,072,291
<p>I think the Flickr API returns the json as type 'text/plain' which then will be displayed as text. You might try 'text/json' as a halfway point. Being easily viewed might outweigh being correct in your case.</p> <p>Also consider that should any client require the content type to be 'application/json' and refuse to ...
1
2009-07-02T03:18:10Z
[ "python", "ajax", "json", "api", "google-app-engine" ]
Is this a correct way to return JSON in Python/GAE for parsing in JavaScript?
1,072,281
<p>I am making an API for some AJAX related things in my web app on GAE in Python. After setting the content-type to 'application/json' and accessing my url directly-</p> <pre><code>http://mysite.com/api?method=theMethod&amp;param=firstParam </code></pre> <p>-I am being prompted with a 'save file' dialog box instead ...
2
2009-07-02T03:15:11Z
1,072,395
<p>This is the right way, mime type for json is application/json not text/json and NEVER text/html. <a href="http://tools.ietf.org/html/rfc4627" rel="nofollow">http://tools.ietf.org/html/rfc4627</a> starts with "The application/json Media Type for JavaScript Object Notation (JSON)"</p> <p>read <a href="http://simonwil...
4
2009-07-02T03:55:53Z
[ "python", "ajax", "json", "api", "google-app-engine" ]
Use SQLite's backup API from Python/SQLAlchemy
1,072,444
<p>I'm using an SQLite database from python (with <a href="http://www.sqlalchemy.org/" rel="nofollow">SQLAlchemy</a>). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk.</p> <p>SQLite has a <a href="http://www.sqlite.org/backup.html" rel="nof...
4
2009-07-02T04:12:51Z
1,073,589
<p>When I do the following</p> <pre><code>import sqlite3 dir(sqlite3) </code></pre> <p>I see none of the <a href="http://www.sqlite.org/c3ref/backup%5Ffinish.html" rel="nofollow">backup API</a> methods.</p> <p>Therefore, the answer is no; you cannot access the API from the sqlite3 module. It appears that no one imp...
1
2009-07-02T10:18:07Z
[ "python", "sqlite", "sqlalchemy" ]
Use SQLite's backup API from Python/SQLAlchemy
1,072,444
<p>I'm using an SQLite database from python (with <a href="http://www.sqlalchemy.org/" rel="nofollow">SQLAlchemy</a>). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk.</p> <p>SQLite has a <a href="http://www.sqlite.org/backup.html" rel="nof...
4
2009-07-02T04:12:51Z
1,077,925
<p>the APSW dialect can be added to SQLAlchemy pretty easily as well. It would be very easy to achieve in 0.6, which allows multiple kinds of DBAPI adapters to make use of a common dialect for the database in use.</p>
3
2009-07-03T05:54:32Z
[ "python", "sqlite", "sqlalchemy" ]
Use SQLite's backup API from Python/SQLAlchemy
1,072,444
<p>I'm using an SQLite database from python (with <a href="http://www.sqlalchemy.org/" rel="nofollow">SQLAlchemy</a>). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk.</p> <p>SQLite has a <a href="http://www.sqlite.org/backup.html" rel="nof...
4
2009-07-02T04:12:51Z
3,426,144
<p>If pysqlite and apsw are linked against the same sqlite library then pysqlite can accept apsw connections. See:</p> <p><a href="http://docs.pysqlite.googlecode.com/hg/sqlite3.html#combining-apsw-and-pysqlite" rel="nofollow">http://docs.pysqlite.googlecode.com/hg/sqlite3.html#combining-apsw-and-pysqlite</a></p> <p>...
3
2010-08-06T17:21:03Z
[ "python", "sqlite", "sqlalchemy" ]
Use SQLite's backup API from Python/SQLAlchemy
1,072,444
<p>I'm using an SQLite database from python (with <a href="http://www.sqlalchemy.org/" rel="nofollow">SQLAlchemy</a>). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk.</p> <p>SQLite has a <a href="http://www.sqlite.org/backup.html" rel="nof...
4
2009-07-02T04:12:51Z
18,189,301
<p>The <a href="https://github.com/husio/python-sqlite3-backup" rel="nofollow">python-sqlite3-backup</a> module claims to solve this problem.</p>
1
2013-08-12T14:16:09Z
[ "python", "sqlite", "sqlalchemy" ]
Updating one aspect of a Pygame surface
1,072,639
<p>I have an application written in python that's basically an etch-a-sketch, you move pixels around with WASD and arrow keys and it leaves a trail. However, I want to add a counter for the amount of pixels on the screen. How do I have the counter update without updating the entire surface and pwning the pixel drawings...
0
2009-07-02T05:24:19Z
1,073,207
<p>Use <a href="http://www.pygame.org/docs/ref/surface.html" rel="nofollow">Surface</a>.blit(source, dest, area=None, special_flags = 0): return Rect</p> <p><em>dest</em> can be a pair of coordinates representing the upper left corner of the source.</p> <p>You probably want to erase the your old counter value, before...
0
2009-07-02T08:43:49Z
[ "python", "pygame" ]
Python Language Question: attributes of object() vs Function
1,072,649
<p>In python, it is illegal to create new attribute for an object instance like this</p> <pre><code>&gt;&gt;&gt; a = object() &gt;&gt;&gt; a.hhh = 1 </code></pre> <p>throws </p> <pre><code>Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; AttributeError: 'object' object has no attr...
17
2009-07-02T05:27:25Z
1,072,669
<p>The reason function objects support arbitrary attributes is that, before we added that feature, several frameworks (e.g. parser generator ones) were abusing function docstrings (and other attribute of function objects) to stash away per-function information that was crucial to them -- the need for such association o...
22
2009-07-02T05:33:52Z
[ "python", "function", "object" ]
Python Language Question: attributes of object() vs Function
1,072,649
<p>In python, it is illegal to create new attribute for an object instance like this</p> <pre><code>&gt;&gt;&gt; a = object() &gt;&gt;&gt; a.hhh = 1 </code></pre> <p>throws </p> <pre><code>Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; AttributeError: 'object' object has no attr...
17
2009-07-02T05:27:25Z
1,072,763
<p>Alex Martelli posted an awesome answer to your question. For anyone who is looking for a good way to accomplish arbitrary attributes on an empty object, do this:</p> <pre><code>class myobject(object): pass o = myobject() o.anything = 123 </code></pre> <p>Or more efficient (and better documented) if you know ...
7
2009-07-02T06:15:15Z
[ "python", "function", "object" ]
Python Language Question: attributes of object() vs Function
1,072,649
<p>In python, it is illegal to create new attribute for an object instance like this</p> <pre><code>&gt;&gt;&gt; a = object() &gt;&gt;&gt; a.hhh = 1 </code></pre> <p>throws </p> <pre><code>Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; AttributeError: 'object' object has no attr...
17
2009-07-02T05:27:25Z
1,073,573
<p>The rationale is that an instance of <code>object()</code> is a degenerate special case. It "is" an object but it isn't designed to be useful by itself.</p> <p>Think of <code>object</code> as a temporary hack, bridging old-style types and classes. In Python 3.0 it will fade into obscurity because it will no longe...
1
2009-07-02T10:11:02Z
[ "python", "function", "object" ]
Python Language Question: attributes of object() vs Function
1,072,649
<p>In python, it is illegal to create new attribute for an object instance like this</p> <pre><code>&gt;&gt;&gt; a = object() &gt;&gt;&gt; a.hhh = 1 </code></pre> <p>throws </p> <pre><code>Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; AttributeError: 'object' object has no attr...
17
2009-07-02T05:27:25Z
20,256,311
<p>Here's another alternative, as short as I could make it:</p> <pre><code>&gt;&gt;&gt; dummy = type('', (), {})() &gt;&gt;&gt; dummy.foo = 5 &gt;&gt;&gt; dummy.foo 5 </code></pre>
0
2013-11-28T01:43:52Z
[ "python", "function", "object" ]
Playing MMS streams within Python
1,072,652
<p>I'm writing a XM desktop application (I plan on releasing the source on github when I'm finished if anyone is interested) Anyway, the one part I know very little about is how to play media within Python (I'm using PyQt for the frontend). Basically, I have a mms:// url that I need to play. I was wondering if there is...
1
2009-07-02T05:28:34Z
1,072,688
<p>You can have a look at </p> <ol> <li><a href="http://pymedia.org/" rel="nofollow">PyMedia</a></li> <li><a href="http://www.pygame.org/" rel="nofollow">PyGame</a></li> <li><a href="http://www.wxpython.org/" rel="nofollow">wxPython</a></li> </ol> <p><a href="http://www.daniweb.com/code/snippet467.html#" rel="nofollo...
2
2009-07-02T05:43:18Z
[ "python", "streaming", "pyqt", "audio-streaming", "mms" ]
Updating part of a surface in python, or transparent surfaces
1,072,734
<p>I have an application written in python that's basically an etch-a-sketch, you move pixels around with WASD and arrow keys and it leaves a trail. However, I want to add a counter for the amount of pixels on the screen. How do I have the counter update without updating the entire surface and pwning the pixel drawings...
1
2009-07-02T06:03:39Z
1,072,808
<p>What you need is pygame.font module</p> <pre><code>#define a font surface spamSurface = pygame.font.SysFont('Arial', 20) #then, in your infinite cycle... eggsPixels = spamSurface.render(str(pixelsOnScreen), True, (255, 255, 255)) hamDisplay.blit(eggsPixels, (10, 10)) </code></pre> <p>Where <code>spamSurface</...
0
2009-07-02T06:35:37Z
[ "python", "pygame" ]
Updating part of a surface in python, or transparent surfaces
1,072,734
<p>I have an application written in python that's basically an etch-a-sketch, you move pixels around with WASD and arrow keys and it leaves a trail. However, I want to add a counter for the amount of pixels on the screen. How do I have the counter update without updating the entire surface and pwning the pixel drawings...
1
2009-07-02T06:03:39Z
1,117,885
<p>To solve this problem, you want to have a separate surface for your Etch-a-Sketch pixels, so that they do not get clobbered when you go to refresh the screen. Unfortunately, with Rigo's scheme, the font will continue to render on top of itself, which will get messy for more than two pixel count changes.</p> <p>So,...
1
2009-07-13T06:00:04Z
[ "python", "pygame" ]
How can I deal with No module named edit.editor?
1,072,736
<p>I am trying to follow the <a href="http://wingware.com/doc/scripting/example" rel="nofollow">WingIDE tutorial</a> on creating scripts in the IDE. </p> <p>This following example scripts always throws an error:</p> <pre><code>import wingapi def test_script(test_str): app = wingapi.gApplication v = "Product info ...
0
2009-07-02T06:03:45Z
1,078,574
<p>Answer is based on email from Stephan Deibel from the Wingware company that develops Wind IDE.</p> <blockquote> <p>Scripts are not launched in Wing's debugger. If you're editing them within Wing, they get reloaded as soon as you save and you should be able to use Command By Name in the edit menu to type test-scr...
1
2009-07-03T09:29:52Z
[ "python", "wing-ide" ]
Is modifying a class variable in python threadsafe?
1,072,821
<p>I was reading <a href="http://stackoverflow.com/questions/1071935/i-need-a-python-class-that-keep-tracks-of-how-many-times-it-is-instanciated">this question</a> (which you do not have to read because I will copy what is there... I just wanted to give show you my inspiration)...</p> <p>So, if I have a class that cou...
13
2009-07-02T06:38:59Z
1,072,851
<p>I would say it is thread-safe, at least on CPython implementation. The GIL will make all your "threads" to run sequentially so they will not be able to mess with your reference count.</p>
-2
2009-07-02T06:48:03Z
[ "python", "multithreading" ]
Is modifying a class variable in python threadsafe?
1,072,821
<p>I was reading <a href="http://stackoverflow.com/questions/1071935/i-need-a-python-class-that-keep-tracks-of-how-many-times-it-is-instanciated">this question</a> (which you do not have to read because I will copy what is there... I just wanted to give show you my inspiration)...</p> <p>So, if I have a class that cou...
13
2009-07-02T06:38:59Z
1,073,230
<p>It's not threadsafe even on CPython. Try this to see for yourself:</p> <pre><code>import threading class Foo(object): instance_count = 0 def inc_by(n): for i in xrange(n): Foo.instance_count += 1 threads = [threading.Thread(target=inc_by, args=(100000,)) for thread_nr in xrange(100)] for thread i...
20
2009-07-02T08:48:52Z
[ "python", "multithreading" ]
Is modifying a class variable in python threadsafe?
1,072,821
<p>I was reading <a href="http://stackoverflow.com/questions/1071935/i-need-a-python-class-that-keep-tracks-of-how-many-times-it-is-instanciated">this question</a> (which you do not have to read because I will copy what is there... I just wanted to give show you my inspiration)...</p> <p>So, if I have a class that cou...
13
2009-07-02T06:38:59Z
1,074,035
<p>No it is not thread safe. I've faced a similar problem a few days ago and I choosed to implement the lock thanks to a decorator. The benefit is that it makes the code readable:</p> <pre> def threadsafe_function(fn): """decorator making sure that the decorated function is thread safe""" lock = threading.Lock...
7
2009-07-02T12:17:09Z
[ "python", "multithreading" ]
How to convert XSD to Python Class
1,072,853
<p>I just want to know if there is a program that can convert an XSD file to a Python class as <strong>JAXB</strong> does for Java?</p>
29
2009-07-02T06:49:23Z
1,072,989
<p><a href="http://pythonhosted.org/generateDS/">generateDS</a> : I think this is the good tool I need </p> <p>Edit : Actually, generateDS does very well the job !! It generates the Python class with all methods (setters and getters, export to XML, import from XML). It works very well !</p>
24
2009-07-02T07:35:15Z
[ "python", "xml", "data-binding", "xsd", "xsd2code" ]
How to convert XSD to Python Class
1,072,853
<p>I just want to know if there is a program that can convert an XSD file to a Python class as <strong>JAXB</strong> does for Java?</p>
29
2009-07-02T06:49:23Z
1,073,556
<p>Look at <a href="http://pypi.python.org/pypi/rsl.xsd/0.2.3" rel="nofollow">http://pypi.python.org/pypi/rsl.xsd/0.2.3</a></p> <p>Also, you might want <a href="http://pyxsd.org/" rel="nofollow">http://pyxsd.org/</a> it works very nicely.</p>
1
2009-07-02T10:06:33Z
[ "python", "xml", "data-binding", "xsd", "xsd2code" ]
How to convert XSD to Python Class
1,072,853
<p>I just want to know if there is a program that can convert an XSD file to a Python class as <strong>JAXB</strong> does for Java?</p>
29
2009-07-02T06:49:23Z
10,815,021
<p>PyXB: <a href="http://pyxb.sourceforge.net/">http://pyxb.sourceforge.net/</a></p>
8
2012-05-30T11:06:22Z
[ "python", "xml", "data-binding", "xsd", "xsd2code" ]
date is added in background while adding time in datastore GAE
1,072,877
<p>3.Why does "jan 1st 1970" gets added in the startime field in datastore when I am doing the below statements?</p> <pre><code> (hour,min) = self.request.get('starttime').split(":") #if either of them is null or empty string then int will throw exception if hour and min : datastoremodel.starttime = datetime.time(...
0
2009-07-02T06:55:19Z
1,073,053
<p>google app engine <a href="http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#TimeProperty" rel="nofollow">doc</a> says</p> <pre><code>class TimeProperty(verbose_name=None, auto_now=False, auto_now_add=False, ...) A time property, without a date. Takes a Python standard library date...
2
2009-07-02T07:53:29Z
[ "python", "google-app-engine", "datetime" ]
Printing python modulus operator as it is over command line
1,072,951
<p>I want to print modulus operator as it is over the command line: E.g this is how the output should look like:<br/> 1%2<br/> 2%4</p> <p>or<br/> 30%<br/> 40%</p> <p>I am using the print statement like this:<br/></p> <blockquote> <p>print 'computing %s % %s' % (num1, num2)</p> </blockquote> <p>Its throwing the ...
3
2009-07-02T07:21:52Z
1,072,959
<pre><code>print 'computing %s %% %s' % (num1, num2) </code></pre>
1
2009-07-02T07:24:10Z
[ "python", "operators", "modulo" ]
Printing python modulus operator as it is over command line
1,072,951
<p>I want to print modulus operator as it is over the command line: E.g this is how the output should look like:<br/> 1%2<br/> 2%4</p> <p>or<br/> 30%<br/> 40%</p> <p>I am using the print statement like this:<br/></p> <blockquote> <p>print 'computing %s % %s' % (num1, num2)</p> </blockquote> <p>Its throwing the ...
3
2009-07-02T07:21:52Z
1,072,963
<p>Escape the % sign with another % sign, like this:</p> <pre><code>print 'computing %s %% %s' % (num1, num2) </code></pre>
7
2009-07-02T07:25:29Z
[ "python", "operators", "modulo" ]
Calculate score in a pyramid score system
1,072,977
<p>I am trying to calculate gamescores for a bunch over users and I haven't really got it yet. It is a pyramid game where you can invite people, and the people you invite is placed beneth you in the relations tree.</p> <p>So if i invite X and X invites Y i get kickback from both of them. Let's say 10%^steps...</p> <p...
1
2009-07-02T07:30:07Z
1,073,002
<p>I doubt these two lines</p> <pre><code>score += child.points*math.pow(.1, get_ancestors(child)) score += get_score(child) </code></pre> <p>this is a simple recursive structure so i think something like below will suffice</p> <pre><code>score += get_score(child)*.1 </code></pre> <p>and recursive beauty will take...
2
2009-07-02T07:39:13Z
[ "python", "recursion" ]
Calculate score in a pyramid score system
1,072,977
<p>I am trying to calculate gamescores for a bunch over users and I haven't really got it yet. It is a pyramid game where you can invite people, and the people you invite is placed beneth you in the relations tree.</p> <p>So if i invite X and X invites Y i get kickback from both of them. Let's say 10%^steps...</p> <p...
1
2009-07-02T07:30:07Z
1,073,062
<p>This can have very different implementations, depending on the way the score must be calculating :</p> <ul> <li><p>Do you need to propagate the result of each gain, in real time ? In that case , you start from the bottom of the pyramid and give the feedback until the top.</p></li> <li><p>Can you afford the result t...
0
2009-07-02T07:56:31Z
[ "python", "recursion" ]
Is generator.next() visible in python 3.0?
1,073,396
<p>I have a generator that generates a series, for example:</p> <pre><code>def triangleNums(): '''generate series of triangle numbers''' tn = 0 counter = 1 while(True): tn = tn + counter yield tn counter = counter + 1 </code></pre> <p>in python 2.6 I am able to make the followi...
82
2009-07-02T09:29:44Z
1,073,407
<p>Try:</p> <pre><code>next(g) </code></pre> <p>Check out <a href="http://www.diveinto.org/python3/porting-code-to-python-3-with-2to3.html#next">this neat table</a> that shows the differences in syntax between 2 and 3 when it comes to this.</p>
49
2009-07-02T09:31:19Z
[ "python", "python-3.x", "iteration" ]
Is generator.next() visible in python 3.0?
1,073,396
<p>I have a generator that generates a series, for example:</p> <pre><code>def triangleNums(): '''generate series of triangle numbers''' tn = 0 counter = 1 while(True): tn = tn + counter yield tn counter = counter + 1 </code></pre> <p>in python 2.6 I am able to make the followi...
82
2009-07-02T09:29:44Z
1,073,582
<p>Correct, <code>g.next()</code> has been renamed to <code>g.__next__()</code>. The reason for this is to have consistence. Special methods like <code>__init__()</code> and <code>__del__</code> all have double underscores (or "dunder" as it is getting popular to call them now), and .next() is one of the few exceptions...
143
2009-07-02T10:15:53Z
[ "python", "python-3.x", "iteration" ]
Is generator.next() visible in python 3.0?
1,073,396
<p>I have a generator that generates a series, for example:</p> <pre><code>def triangleNums(): '''generate series of triangle numbers''' tn = 0 counter = 1 while(True): tn = tn + counter yield tn counter = counter + 1 </code></pre> <p>in python 2.6 I am able to make the followi...
82
2009-07-02T09:29:44Z
32,636,158
<p>If your code must run under Python2 and Python3, use the 2to3 <a href="https://pythonhosted.org/six/#six.next" rel="nofollow">six</a> library like this:</p> <pre><code>import six six.next(g) # on PY2K: 'g.next()' and onPY3K: 'next(g)' </code></pre>
4
2015-09-17T17:09:59Z
[ "python", "python-3.x", "iteration" ]
PyQt clipboard doesn't copy to system clipboard
1,073,550
<p>The following snippet of code doesn't seem to affect the system clipboard at all:</p> <pre><code>clipboard = QtGui.QApplication.clipboard() clipboard.setText(text) </code></pre> <p>According to the Qt documentation, this is how you copy text to clipboard, </p> <p>Why isn't it working?</p> <p>Googling turned <a h...
7
2009-07-02T10:04:20Z
1,073,788
<p>I know you are not using Windows, but maybe this will give you some ideas... I used this in a PyQt program to copy URLs to the clipboard:</p> <pre><code>import win32clipboard s = 'copy this to the clipboard' try: win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboard...
4
2009-07-02T11:16:23Z
[ "python", "qt", "pyqt", "clipboard" ]
PyQt clipboard doesn't copy to system clipboard
1,073,550
<p>The following snippet of code doesn't seem to affect the system clipboard at all:</p> <pre><code>clipboard = QtGui.QApplication.clipboard() clipboard.setText(text) </code></pre> <p>According to the Qt documentation, this is how you copy text to clipboard, </p> <p>Why isn't it working?</p> <p>Googling turned <a h...
7
2009-07-02T10:04:20Z
1,073,838
<p>You might try <a href="http://library.gnome.org/devel/pygtk/stable/class-gtkclipboard.html" rel="nofollow">gtk.Clipboard</a> from <a href="http://www.pygtk.org/about.html" rel="nofollow">PyGTK</a>. I believe it is multi-platform.</p> <p>This might be part of the reason you're having trouble with PyQt's <a href="ht...
0
2009-07-02T11:30:43Z
[ "python", "qt", "pyqt", "clipboard" ]
PyQt clipboard doesn't copy to system clipboard
1,073,550
<p>The following snippet of code doesn't seem to affect the system clipboard at all:</p> <pre><code>clipboard = QtGui.QApplication.clipboard() clipboard.setText(text) </code></pre> <p>According to the Qt documentation, this is how you copy text to clipboard, </p> <p>Why isn't it working?</p> <p>Googling turned <a h...
7
2009-07-02T10:04:20Z
23,119,741
<p>You may need to specify the <a href="http://pyqt.sourceforge.net/Docs/PyQt4/qclipboard.html#Mode-enum" rel="nofollow">mode</a>.</p> <p>This code worked for me on windows:</p> <pre><code> cb = QtGui.QApplication.clipboard() cb.clear(mode=cb.Clipboard ) cb.setText("Clipboard Text", mode=cb.Clipboard) </co...
3
2014-04-16T20:43:15Z
[ "python", "qt", "pyqt", "clipboard" ]
Why does SCons VariantDir() not put output in the given directory?
1,074,062
<p>I'm thinking about using <a href="http://www.scons.org/">SCons</a> for a new project. It looks really good, though I'm finding <code>VariantDir</code> quite confusing.</p> <p>I have a simple project with a handful of C source files in one directory, and I want to build in "normal" and in "profile" mode -- with two ...
7
2009-07-02T12:26:40Z
1,074,587
<p>Yes, VariantDir is confusing in scons. Although not well advertised, you can put both SConstruct and SConscript in the same directory, using the current directory as the source directory</p> <pre><code># SConstruct SConscript('SConscript', build_dir='build', src='.') </code></pre> <p>and</p> <pre><code># SConscri...
7
2009-07-02T14:10:23Z
[ "python", "c", "makefile", "scons" ]
Why does SCons VariantDir() not put output in the given directory?
1,074,062
<p>I'm thinking about using <a href="http://www.scons.org/">SCons</a> for a new project. It looks really good, though I'm finding <code>VariantDir</code> quite confusing.</p> <p>I have a simple project with a handful of C source files in one directory, and I want to build in "normal" and in "profile" mode -- with two ...
7
2009-07-02T12:26:40Z
1,181,212
<p>I was able to separate binaries in a build directory using this call:</p> <pre><code># SConstruct SConscript('SConscript', variant_dir='build', src_dir='..', duplicate=0) </code></pre> <p>If you want to put binaries into a directory two levels below, do this:</p> <pre><code># SConstruct SConscript('SConscript', v...
6
2009-07-25T04:39:19Z
[ "python", "c", "makefile", "scons" ]
Why does SCons VariantDir() not put output in the given directory?
1,074,062
<p>I'm thinking about using <a href="http://www.scons.org/">SCons</a> for a new project. It looks really good, though I'm finding <code>VariantDir</code> quite confusing.</p> <p>I have a simple project with a handful of C source files in one directory, and I want to build in "normal" and in "profile" mode -- with two ...
7
2009-07-02T12:26:40Z
24,505,810
<p>As <a href="http://www.scons.org/wiki/VariantDir%28%29" rel="nofollow">http://www.scons.org/wiki/VariantDir%28%29</a> said, </p> <blockquote> <p>Note that when you're not using an SConscript file in the src subdirectory, you must actually specify that the program must be built from the build/hello.c file that SCo...
2
2014-07-01T08:36:15Z
[ "python", "c", "makefile", "scons" ]
Pyinstaller traceback
1,074,144
<pre><code>Traceback (most recent call last): File "&lt;string&gt;", line 137, in &lt;module&gt; File C:\Python26\buildSVG_Resizer\out1.pyz/encodings", line 100, in search_function TypeError: importHook() got an unexpected keyword argument 'level' </code></pre> <p>The imports in my .py file are:</p> <pre><code>impor...
0
2009-07-02T12:47:17Z
1,074,750
<p><code>importHook</code> in <code>iu.py</code> (top level of pyinstaller) does accept a <code>level=</code> named argument, so the message is quite perplexing and suggests a bad installation.</p> <p>What output do you get from cd'ing to pyinstaller's top directory and doing:</p> <pre><code>svn log -r HEAD </code></...
1
2009-07-02T14:33:51Z
[ "python" ]
Serve a dynamically generated image with Django
1,074,200
<p>How do I serve a dynamically generated image in Django? </p> <p>I have an html tag</p> <pre><code>&lt;html&gt; ... &lt;img src="images/dynamic_chart.png" /&gt; ... &lt;/html&gt; </code></pre> <p>linked up to this request handler, which creates an in-memory image</p> <pre><code>def chart(request): img = I...
23
2009-07-02T12:59:55Z
1,074,270
<p>I'm relatively new to Django myself. I haven't been able to find anything in Django itself, but I have stumbled upon a project on Google Code that may be of some help to you:</p> <p><a href="http://code.google.com/p/django-dynamic-media-serve/" rel="nofollow">django-dynamic-media-serve</a></p>
3
2009-07-02T13:13:36Z
[ "python", "ajax", "django", "image" ]
Serve a dynamically generated image with Django
1,074,200
<p>How do I serve a dynamically generated image in Django? </p> <p>I have an html tag</p> <pre><code>&lt;html&gt; ... &lt;img src="images/dynamic_chart.png" /&gt; ... &lt;/html&gt; </code></pre> <p>linked up to this request handler, which creates an in-memory image</p> <pre><code>def chart(request): img = I...
23
2009-07-02T12:59:55Z
1,074,277
<p>I assume you're using PIL (Python Imaging Library). You need to replace your last line with (for example, if you want to serve a PNG image):</p> <pre><code>response = HttpResponse(mimetype="image/png") img.save(response, "PNG") return response </code></pre> <p>See <a href="http://effbot.org/zone/django-pil.htm">he...
22
2009-07-02T13:15:02Z
[ "python", "ajax", "django", "image" ]
restore registry from file
1,074,467
<p>I am trying to migrate microsoft office settings from one system to other system by backing up office registry and restoring it on the destination machine using Python.I am able to do the saving part,but on trying to restore the existing settings in destination machine to overwrite existing office settings,i am gett...
1
2009-07-02T13:53:02Z
1,614,364
<p>The registry system has a built-in method for updating registry keys by creating and importing a .reg text file. I suggest that you try to write your changes to a .reg file and import that.</p> <p>Also, you don't mention what Windows version you are using. In the newer versions, the permission system is rather more...
1
2009-10-23T15:52:02Z
[ "python", "registry" ]
Generating an image thumbnail that is <10KB and did not lose proportions
1,075,037
<p>Notice how for every image that google indexes it has a small <a href="http://images.google.com/images?q=jeff+atwood" rel="nofollow">thumbnail</a>. These thumbnails are:</p> <ol> <li>Less than 10KB in size.</li> <li>The proportions of the width / height are the same as the ones in the original image.</li> </ol> <p...
1
2009-07-02T15:22:30Z
1,075,079
<p>Did you read the <a href="http://www.pythonware.com/library/pil/handbook/image.htm" rel="nofollow">PIL documentation</a>? There is an image.thumbnail method.</p>
1
2009-07-02T15:30:37Z
[ "python", "image-processing", "python-imaging-library" ]
Generating an image thumbnail that is <10KB and did not lose proportions
1,075,037
<p>Notice how for every image that google indexes it has a small <a href="http://images.google.com/images?q=jeff+atwood" rel="nofollow">thumbnail</a>. These thumbnails are:</p> <ol> <li>Less than 10KB in size.</li> <li>The proportions of the width / height are the same as the ones in the original image.</li> </ol> <p...
1
2009-07-02T15:22:30Z
1,075,089
<p>In <a href="http://mail.python.org/pipermail/python-list/2005-August/338139.html" rel="nofollow">this short post</a>, Mike Fletcher and the effbot show (and discuss detailed variation) an excellent approach for the task you want to do.</p> <p><strong>Edit</strong>: as for the 10K requirement, it's hard (to say the ...
3
2009-07-02T15:32:59Z
[ "python", "image-processing", "python-imaging-library" ]
Generating an image thumbnail that is <10KB and did not lose proportions
1,075,037
<p>Notice how for every image that google indexes it has a small <a href="http://images.google.com/images?q=jeff+atwood" rel="nofollow">thumbnail</a>. These thumbnails are:</p> <ol> <li>Less than 10KB in size.</li> <li>The proportions of the width / height are the same as the ones in the original image.</li> </ol> <p...
1
2009-07-02T15:22:30Z
1,075,277
<p>Use PIL, see sample code here to resize keeping aspect ratio</p> <p><a href="http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio">http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio</a></p> <p>see how to d...
1
2009-07-02T16:11:54Z
[ "python", "image-processing", "python-imaging-library" ]
How do I find the memory address of a Python / Django model object?
1,075,106
<p>An ordinary object, I can use </p> <pre><code>o.__repr__() </code></pre> <p>to see something like </p> <pre><code>'&lt;__main__.A object at 0x9d78fec&gt;' </code></pre> <p>But, say, a Django User just returns </p> <pre><code>&lt;User:bob&gt; </code></pre> <p>How can I see the actual address of one of these, or...
0
2009-07-02T15:35:53Z
1,075,130
<p>Use the id() function for that. Or equivalently just compare "obj1 is obj2".</p>
1
2009-07-02T15:40:15Z
[ "python", "django", "django-models" ]
How do I find the memory address of a Python / Django model object?
1,075,106
<p>An ordinary object, I can use </p> <pre><code>o.__repr__() </code></pre> <p>to see something like </p> <pre><code>'&lt;__main__.A object at 0x9d78fec&gt;' </code></pre> <p>But, say, a Django User just returns </p> <pre><code>&lt;User:bob&gt; </code></pre> <p>How can I see the actual address of one of these, or...
0
2009-07-02T15:35:53Z
1,075,131
<p><code>id()</code> will return the identity of the object (generally implemented as the address), which is guaranteed unique for two objects which exist at the same point in time. However the obvious way to check whether two objects are identical is to use the operator explicitely designed for this: <code>is</code><...
7
2009-07-02T15:40:20Z
[ "python", "django", "django-models" ]
How do I find the memory address of a Python / Django model object?
1,075,106
<p>An ordinary object, I can use </p> <pre><code>o.__repr__() </code></pre> <p>to see something like </p> <pre><code>'&lt;__main__.A object at 0x9d78fec&gt;' </code></pre> <p>But, say, a Django User just returns </p> <pre><code>&lt;User:bob&gt; </code></pre> <p>How can I see the actual address of one of these, or...
0
2009-07-02T15:35:53Z
1,075,148
<p>You can get the id of any object:</p> <pre><code>a = object() print hex(id(a)) </code></pre> <p>Although for CPython, this is the address of the object, this is not guaranteed I believe (and may be different on other implementations like iron python). Same id means same object, though.</p>
2
2009-07-02T15:44:13Z
[ "python", "django", "django-models" ]
How to debug SCons scripts using eclipse and pydev?
1,075,304
<p>I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?</p>
3
2009-07-02T16:16:07Z
1,075,694
<p>I'm not an Eclipse expert, but since you didn't get any other answer...</p> <p>If you make the SCons source a part of the Eclipse project, and run the whole command from within Eclipse it should work like any Eclipse debugging. SCons is written in Python, there is no reason it shouldn't be debuggable in Eclipse jus...
2
2009-07-02T17:33:35Z
[ "python", "eclipse", "pydev", "scons" ]
How to debug SCons scripts using eclipse and pydev?
1,075,304
<p>I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?</p>
3
2009-07-02T16:16:07Z
1,077,102
<p>You are right. Since the SCons is python based, the SCons scripts are debuggable via EClipse PyDev. For this, you need to do the following in the debug configuration... <li>1. Under the main tab, set the main module to the SCons file which will be available under the python/scripts directory if you have installed ...
5
2009-07-02T22:58:13Z
[ "python", "eclipse", "pydev", "scons" ]
How to debug SCons scripts using eclipse and pydev?
1,075,304
<p>I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?</p>
3
2009-07-02T16:16:07Z
6,202,513
<p>if you are using SCons for C/C++ development and Eclipse CDT check out <a href="http://sconsolidator.com" rel="nofollow">http://sconsolidator.com</a> (within the next weeks), we will release our SCons Eclipse plug-in for free public use shortly. It also contains an "interactive mode" that allows SCons builds to run ...
1
2011-06-01T14:07:25Z
[ "python", "eclipse", "pydev", "scons" ]
How to debug SCons scripts using eclipse and pydev?
1,075,304
<p>I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?</p>
3
2009-07-02T16:16:07Z
15,386,322
<p>On MAC to debug scons through pydev follow Lennart's answer but with one simply addition.</p> <p>Using Finder (or terminal) browse to where scons is installed. You can find this with the "which" command.</p> <p>e.g. which scons -> /usr/local/bin/scons</p> <p>Make a copy of the scons file and call it scons.py.</p>...
1
2013-03-13T13:12:11Z
[ "python", "eclipse", "pydev", "scons" ]
How to debug SCons scripts using eclipse and pydev?
1,075,304
<p>I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?</p>
3
2009-07-02T16:16:07Z
32,887,089
<p>I've since gain more experience with SCons / Python and I'd recommend using python's pdb module. To use it simply add the following code to your SCons/Python files.</p> <p>import pdb; pdb.set_trace()</p> <p>When the file is run from the command line a breakpoint will be hit at this line. I also moved away from Ecl...
0
2015-10-01T11:59:25Z
[ "python", "eclipse", "pydev", "scons" ]
CherryPy interferes with Twisted shutting down on Windows
1,075,351
<p>I've got an application that runs Twisted by starting the reactor with <code>reactor.run()</code> in my main thread after starting some other threads, including the CherryPy web server. Here's a program that shuts down cleanly when Ctrl+C is pressed on Linux but not on Windows:</p> <pre><code>from threading import...
7
2009-07-02T16:25:05Z
1,080,010
<p>CherryPy handles signals by default when you call quickstart. In your case, you should probably just unroll quickstart, which is only a few lines, and pick and choose. Here's basically what quickstart does in trunk:</p> <pre><code>if config: cherrypy.config.update(config) tree.mount(root, script_name, config) ...
14
2009-07-03T16:14:12Z
[ "python", "windows", "linux", "twisted", "cherrypy" ]
Does python have hooks into EXT3
1,075,391
<p>We have several cron jobs that ftp proxy logs to a centralized server. These files can be rather large and take some time to transfer. Part of the requirement of this project is to provide a logging mechanism in which we log the success or failure of these transfers. This is simple enough.</p> <p>My question is, is...
4
2009-07-02T16:32:54Z
1,075,459
<p>no need for ext3-specific hooks; just check <code>lsof</code>, or more exactly, <code>/proc/&lt;pid&gt;/fd/*</code> and <code>/proc/&lt;pid&gt;/fdinfo/*</code> (that's where <code>lsof</code> gets it's info, AFAICT). There you can check if the file is open, if it's writeable, and the 'cursor' position.</p> <p>That...
7
2009-07-02T16:45:20Z
[ "python", "linux", "ext3" ]
Does python have hooks into EXT3
1,075,391
<p>We have several cron jobs that ftp proxy logs to a centralized server. These files can be rather large and take some time to transfer. Part of the requirement of this project is to provide a logging mechanism in which we log the success or failure of these transfers. This is simple enough.</p> <p>My question is, is...
4
2009-07-02T16:32:54Z
1,075,518
<p>There's no ext3 hooks to check what you'd want directly. </p> <ul> <li>I suppose you could dig through the source code of <a href="http://linux.die.net/man/1/fuser" rel="nofollow" title="fuser">Fuser</a> linux command, replicate the part that finds which process owns a file, and watch that resource. When noone long...
1
2009-07-02T16:55:34Z
[ "python", "linux", "ext3" ]
Share objects with file handle attribute between processes
1,075,443
<p>I have a question about shared resource with file handle between processes. Here is my test code:</p> <pre><code>from multiprocessing import Process,Lock,freeze_support,Queue import tempfile #from cStringIO import StringIO class File(): def __init__(self): self.temp = tempfile.TemporaryFile() #...
5
2009-07-02T16:42:46Z
1,077,599
<p>I have to object (at length, won't just fit in a commentl;-) to @Mark's repeated assertion that file handles just can't be "passed around between running processes" -- this is simply not true in real, modern operating systems, such as, oh, say, Unix (free BSD variants, MacOSX, and Linux, included -- hmmm, I wonder w...
6
2009-07-03T02:55:17Z
[ "python", "multiprocessing" ]
Simplifying Data with a for loop (Python)
1,075,631
<p>I was trying to simplify the code:</p> <pre><code> header = [] header.append(header1) header.append(header2) header.append(header3) header.append(header4) header.append(header5) header.append(header6) </code></pre> <...
0
2009-07-02T17:18:53Z
1,075,642
<p>Put the headers in an array and loop through it.</p>
2
2009-07-02T17:21:30Z
[ "python", "string", "loops", "for-loop", "simplify" ]
Simplifying Data with a for loop (Python)
1,075,631
<p>I was trying to simplify the code:</p> <pre><code> header = [] header.append(header1) header.append(header2) header.append(header3) header.append(header4) header.append(header5) header.append(header6) </code></pre> <...
0
2009-07-02T17:18:53Z
1,075,654
<p>You can use <a href="http://docs.python.org/library/functions.html#locals" rel="nofollow"><code>locals</code></a> to get the the local scope as a dict:</p> <pre><code>headerList = [] for i in xrange(1, 7): headerList.append(locals()['header%s' % (i,)]) </code></pre> <p>If possible, though, you should just use ...
2
2009-07-02T17:22:49Z
[ "python", "string", "loops", "for-loop", "simplify" ]
Simplifying Data with a for loop (Python)
1,075,631
<p>I was trying to simplify the code:</p> <pre><code> header = [] header.append(header1) header.append(header2) header.append(header3) header.append(header4) header.append(header5) header.append(header6) </code></pre> <...
0
2009-07-02T17:18:53Z
1,075,658
<pre><code>header = [str(getattr(input, "headerOut%d" % x)) for x in range(1,7)] </code></pre>
5
2009-07-02T17:24:40Z
[ "python", "string", "loops", "for-loop", "simplify" ]
Simplifying Data with a for loop (Python)
1,075,631
<p>I was trying to simplify the code:</p> <pre><code> header = [] header.append(header1) header.append(header2) header.append(header3) header.append(header4) header.append(header5) header.append(header6) </code></pre> <...
0
2009-07-02T17:18:53Z
1,075,659
<p>You should really structure your data as a list or a dictionary, like this:</p> <pre><code>input.headerOut[1] input.headerOut[2] # etc. </code></pre> <p>which would make this a lot easier, and more Pythonic. But you can do what you want using <code>getattr</code>:</p> <pre><code>headerList = [] for i in range(1,...
9
2009-07-02T17:24:58Z
[ "python", "string", "loops", "for-loop", "simplify" ]
Using the AND and NOT Operator in Python
1,075,652
<p>Here is my custom class that I have that represents a triangle. I'm trying to write code that checks to see if <code>self.a</code>, <code>self.b</code>, and <code>self.c</code> are greater than 0, which would mean that I have Angle, Angle, Angle. </p> <p>Below you will see the code that checks for A and B, howeve...
36
2009-07-02T17:22:44Z
1,075,667
<p>Use the keyword "and", not &amp;. &amp; is a bit operator.</p> <p>Be careful with this... just so you know, in Java and C++, the "&amp;" operator is ALSO a bit operator. The correct way to do a boolean comparison in those languages is "&amp;&amp;". Similarly "|" is a bit operator, and "||" is a boolean operator. In...
15
2009-07-02T17:27:17Z
[ "python", "operators" ]
Using the AND and NOT Operator in Python
1,075,652
<p>Here is my custom class that I have that represents a triangle. I'm trying to write code that checks to see if <code>self.a</code>, <code>self.b</code>, and <code>self.c</code> are greater than 0, which would mean that I have Angle, Angle, Angle. </p> <p>Below you will see the code that checks for A and B, howeve...
36
2009-07-02T17:22:44Z
1,075,673
<p>It's called "and" and "or" in Python.</p>
6
2009-07-02T17:27:34Z
[ "python", "operators" ]
Using the AND and NOT Operator in Python
1,075,652
<p>Here is my custom class that I have that represents a triangle. I'm trying to write code that checks to see if <code>self.a</code>, <code>self.b</code>, and <code>self.c</code> are greater than 0, which would mean that I have Angle, Angle, Angle. </p> <p>Below you will see the code that checks for A and B, howeve...
36
2009-07-02T17:22:44Z
1,075,700
<p>You should write :</p> <pre><code>if (self.a != 0) and (self.b != 0) : </code></pre> <p>"<code>&amp;</code>" is the bit wise operator and does not suit for boolean operations. The equivalent of "<code>&amp;&amp;</code>" is "and" in Python.</p> <p>A shorter way to check what you want is to use the "in" operator :...
70
2009-07-02T17:34:31Z
[ "python", "operators" ]
Django template can't see CSS files
1,075,753
<p>I'm building a django app and I can't get the templates to see the CSS files... My settings.py file looks like:</p> <pre><code>MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') MEDIA_URL = '/media/' </code></pre> <p>I've got the CSS files in /mysite/media/css/ and the template code co...
20
2009-07-02T17:45:34Z
1,075,769
<p>in the "development only" block in your urls.py you need to change</p> <pre><code>(r'^media/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': '/media'}), </code></pre> <p>to...</p> <pre><code>(r'^media/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_R...
13
2009-07-02T17:49:13Z
[ "python", "css", "django", "django-templates" ]
Django template can't see CSS files
1,075,753
<p>I'm building a django app and I can't get the templates to see the CSS files... My settings.py file looks like:</p> <pre><code>MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') MEDIA_URL = '/media/' </code></pre> <p>I've got the CSS files in /mysite/media/css/ and the template code co...
20
2009-07-02T17:45:34Z
1,075,780
<p>I had a similar problem when I was trying to get jQuery to work. My fix was to add an alias to my Apache httpd.conf file that pointed to the folder containing the .js. You could do the same with your CSS folder.</p>
0
2009-07-02T17:50:33Z
[ "python", "css", "django", "django-templates" ]
Django template can't see CSS files
1,075,753
<p>I'm building a django app and I can't get the templates to see the CSS files... My settings.py file looks like:</p> <pre><code>MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') MEDIA_URL = '/media/' </code></pre> <p>I've got the CSS files in /mysite/media/css/ and the template code co...
20
2009-07-02T17:45:34Z
1,075,782
<p>On the dev server, I like to cheat and put the following in my urls.py</p> <pre><code>if settings.DEBUG: urlpatterns += patterns('', (r'^includes/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': '/path/to/static/files'}), ) </code></pre> <p>That way anything in the project under...
2
2009-07-02T17:51:11Z
[ "python", "css", "django", "django-templates" ]
Django template can't see CSS files
1,075,753
<p>I'm building a django app and I can't get the templates to see the CSS files... My settings.py file looks like:</p> <pre><code>MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') MEDIA_URL = '/media/' </code></pre> <p>I've got the CSS files in /mysite/media/css/ and the template code co...
20
2009-07-02T17:45:34Z
1,075,800
<p><code>ADMIN_MEDIA_PREFIX</code> is set to <code>\media\</code> by default, and is probably 'stealing' the path. Change that setting, or use a different one for non-admin media - eg <code>site_media</code> or <code>assets</code>.</p>
5
2009-07-02T17:55:10Z
[ "python", "css", "django", "django-templates" ]
Django template can't see CSS files
1,075,753
<p>I'm building a django app and I can't get the templates to see the CSS files... My settings.py file looks like:</p> <pre><code>MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media') MEDIA_URL = '/media/' </code></pre> <p>I've got the CSS files in /mysite/media/css/ and the template code co...
20
2009-07-02T17:45:34Z
3,375,105
<p>It also worked for me, thanks guys !!</p> <p>settings.py</p> <pre><code>MEDIA_ROOT = '/home/pi/ewspaces/ws-classic/xima/media' MEDIA_URL = '/statics/' </code></pre> <p>urls.py</p> <pre><code>if settings.DEBUG: urlpatterns += patterns('', (r'^statics/(?P&lt;path&gt;.*)$', 'django.views.static.serve', ...
1
2010-07-30T20:21:48Z
[ "python", "css", "django", "django-templates" ]
Working with foreign symbols in python
1,075,866
<p>I'm parsing a JSON feed in Python and it contains this character, causing it not to validate. </p> <p>Is there a way to handle these symbols? Can they be converted or is they're a tidy way to remove them? </p> <p>I don't even know what this symbol is called or what causes them, otherwise I would research it mysel...
0
2009-07-02T18:10:35Z
1,075,949
<p>That probably means the text you have is in some sort of encoding, and you need to figure out what encoding, and convert it to Unicode with a thetext.decode('encoding') call.</p> <p>I not sure, but it could possibly be the [?] character, meaning that the display you have there also doesn't know how to display it. T...
1
2009-07-02T18:26:31Z
[ "python", "parsing", "utf-8", "ascii", "symbols" ]
Working with foreign symbols in python
1,075,866
<p>I'm parsing a JSON feed in Python and it contains this character, causing it not to validate. </p> <p>Is there a way to handle these symbols? Can they be converted or is they're a tidy way to remove them? </p> <p>I don't even know what this symbol is called or what causes them, otherwise I would research it mysel...
0
2009-07-02T18:10:35Z
1,396,803
<p>JSON must be encoded in one of UTF-8, UTF-16, or UTF-32. If a JSON file contains bytes which are illegal in its current encoding, it is garbage.</p> <p>If you don't know which encoding it's using, you can try parsing using my <a href="http://pypi.python.org/pypi/jsonlib" rel="nofollow">jsonlib</a> library, which in...
0
2009-09-08T23:06:49Z
[ "python", "parsing", "utf-8", "ascii", "symbols" ]
I want to parse a PAC file to get some Proxy information... just not in Explorer
1,075,899
<p>Follow on from <a href="http://stackoverflow.com/questions/1068212/programitcally-detect-system-proxy-settings-on-windows-xp-with-python/1068303#1068303">this question</a>:</p> <p>I am working on a Python 2.4 app which will run on Windows XP. It needs to be able to download various resources from HTTP and it's got ...
0
2009-07-02T18:16:35Z
1,076,135
<p>Are you able to download the PAC file from the remote host? I am asking because usually urllib in python uses static information for the proxy, retrieved from the registry.<br /> However, if you are able to get that file, then I think you could be able to get also another file - and then your idea of using FF versio...
1
2009-07-02T19:05:29Z
[ "javascript", "python", "windows", "internet-explorer" ]
.class file from jython with pydev
1,075,905
<p>My first attempt at jython is a java/jython project I'm writing in eclipse with pydev.</p> <p>I created a java project and then made it a pydev project by the RightClick project >> pydev >> set as... you get the idea. I then added two source folders, one for java and one for jython, and each source folder has a pac...
3
2009-07-02T18:17:59Z
1,563,692
<p>Following the "Accessing Jython from Java Without Using jythonc" tutorial it became possible to use the jython modules inside java code. The only tricky point is that the *.py modules do not get compiled to *.class files. So it turns out to be exotic scripting inside java. The performance may of course degrade vs jy...
0
2009-10-14T00:29:15Z
[ "java", "python", "eclipse", "jython", "pydev" ]
.class file from jython with pydev
1,075,905
<p>My first attempt at jython is a java/jython project I'm writing in eclipse with pydev.</p> <p>I created a java project and then made it a pydev project by the RightClick project >> pydev >> set as... you get the idea. I then added two source folders, one for java and one for jython, and each source folder has a pac...
3
2009-07-02T18:17:59Z
3,206,809
<p>Jythonc doesn't exist anymore, it has been forked off to another project called <a href="http://github.com/groves/clamp/">Clamp</a>, but with that said...</p> <blockquote> <p>...you can pre-compile your python scripts to .class files using:</p> <p>jython [jython home]/Lib/compileall.py [the directory w...
5
2010-07-08T18:35:00Z
[ "java", "python", "eclipse", "jython", "pydev" ]
Extending Python with C/C++
1,076,300
<p>Can anyone please give me tips on the tools or sofware to use to extend Python with C/C++? Thanks.</p>
4
2009-07-02T19:42:30Z
1,076,318
<p>We use SWIG to wrap our C/C++ libraries for use in Python. It works quite well.</p> <p><a href="http://www.swig.org/">http://www.swig.org/</a></p>
8
2009-07-02T19:45:43Z
[ "c++", "python", "c" ]