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 |
|---|---|---|---|---|---|---|---|---|---|
Finding the joy of Javascript or searching for another UI-focused languages? | 1,823,692 | <p>I'm a GUI designer/interactive musician wanting to improve my programming chops. I already know the basics(variables, loops, arrays, if/else, some logic), but I'm looking to learn in a structured way. I've seen some great books/tuts on Python and Processing (and even Flash)that aim to teach the fundamentals of progr... | 0 | 2009-12-01T02:51:01Z | 1,823,717 | <p>I think you want to work on web interface programming not GUI (windows forms)..
Jquery is the best way to go and when it comes to web dev there is no escaping from Javascript.. I try and comiple some good sites .. give me some time</p>
| 0 | 2009-12-01T02:58:35Z | [
"javascript",
"python",
"user-interface",
"processing"
] |
Finding the joy of Javascript or searching for another UI-focused languages? | 1,823,692 | <p>I'm a GUI designer/interactive musician wanting to improve my programming chops. I already know the basics(variables, loops, arrays, if/else, some logic), but I'm looking to learn in a structured way. I've seen some great books/tuts on Python and Processing (and even Flash)that aim to teach the fundamentals of progr... | 0 | 2009-12-01T02:51:01Z | 1,824,207 | <p>I suggest finding the joy in JavaScript. It sounds to me like your market may be in the browser, in other words, downloaded applications aren't what you're looking for. If this is the case, you don't have much of a choice: JavaScript or Flash.</p>
<p>If you had trouble with OOP, I suggest you find the joy in tha... | 0 | 2009-12-01T05:40:05Z | [
"javascript",
"python",
"user-interface",
"processing"
] |
Finding the joy of Javascript or searching for another UI-focused languages? | 1,823,692 | <p>I'm a GUI designer/interactive musician wanting to improve my programming chops. I already know the basics(variables, loops, arrays, if/else, some logic), but I'm looking to learn in a structured way. I've seen some great books/tuts on Python and Processing (and even Flash)that aim to teach the fundamentals of progr... | 0 | 2009-12-01T02:51:01Z | 29,637,042 | <p>Ok this is an old post, hope this still be useful to you. Try this book: "Modern Javascript Develop and Design" by Larry Ullman, he's a great author with a very clear and easy to follow style. I have learn PHP basic, intermediate and advanced with his books, even some OOP, so I think this could be a great tool for y... | 0 | 2015-04-14T20:42:18Z | [
"javascript",
"python",
"user-interface",
"processing"
] |
in protocol with regard to sequence | 1,823,752 | <p>How is this implemented at a python level?</p>
<p>I've got an object that pretends to be a dict for the most part (in retrospect I should have just subclassed dict, but I'd rather not refactor the codebase, and I'd also like to know this for future reference), which looks something a bit like</p>
<pre><code>class ... | 0 | 2009-12-01T03:09:22Z | 1,823,774 | <p>It sounds like you want to overload the in operator?</p>
<p>You can do that by defining the method <code>__contains__</code>: <a href="http://docs.python.org/reference/datamodel.html#object.%5F%5Fcontains%5F%5F" rel="nofollow">http://docs.python.org/reference/datamodel.html#object.%5F%5Fcontains%5F%5F</a></p>
| 3 | 2009-12-01T03:18:33Z | [
"python",
"protocols"
] |
in protocol with regard to sequence | 1,823,752 | <p>How is this implemented at a python level?</p>
<p>I've got an object that pretends to be a dict for the most part (in retrospect I should have just subclassed dict, but I'd rather not refactor the codebase, and I'd also like to know this for future reference), which looks something a bit like</p>
<pre><code>class ... | 0 | 2009-12-01T03:09:22Z | 1,823,779 | <p>For the best support for the <code>in</code> operator (containment aka membership checking), implement the <code>__contains__</code> special method on your <code>configThinger</code> class:</p>
<pre><code>class configThinger(object):
_config = {}
def __getitem__(self, key):
return self._config[key]
... | 1 | 2009-12-01T03:19:52Z | [
"python",
"protocols"
] |
SendKeys for Python 3.1 on Windows | 1,823,762 | <p>The latest Python Sendkeys module is for Python 2.6. I can't upgrade it myself as it needs the C module to be recompiled.</p>
<p>Does anyone know of a fairly easy alternative way to send keys to a window?</p>
<p>Using win32ui.FindWindow() I can find the right window, then make it active with PyCWnd.SetActiveWindow... | 2 | 2009-12-01T03:12:07Z | 1,823,787 | <p>You want the keybd_event API. My PushKeys program is syntax compatible with SendKeys and has a sleep function built in. Although it isn't in Python it should be translatable readily enough (its been translated into a lot of languages - at least it should show you the API to use). It is <a href="http://mc-computing.c... | 0 | 2009-12-01T03:21:16Z | [
"python",
"sendkeys"
] |
SendKeys for Python 3.1 on Windows | 1,823,762 | <p>The latest Python Sendkeys module is for Python 2.6. I can't upgrade it myself as it needs the C module to be recompiled.</p>
<p>Does anyone know of a fairly easy alternative way to send keys to a window?</p>
<p>Using win32ui.FindWindow() I can find the right window, then make it active with PyCWnd.SetActiveWindow... | 2 | 2009-12-01T03:12:07Z | 1,824,393 | <p>Got something that works, using win32api.keybd_event. </p>
<p>Looks like SendInput would be safer, but pywin32 does not include it.</p>
<p>[ edit: See a SendInput version in the accepted answer below. I leave this message here in case someone prefers to use sendkeys. jh ]</p>
<p>This page helped: <a href="http://... | 3 | 2009-12-01T06:39:13Z | [
"python",
"sendkeys"
] |
SendKeys for Python 3.1 on Windows | 1,823,762 | <p>The latest Python Sendkeys module is for Python 2.6. I can't upgrade it myself as it needs the C module to be recompiled.</p>
<p>Does anyone know of a fairly easy alternative way to send keys to a window?</p>
<p>Using win32ui.FindWindow() I can find the right window, then make it active with PyCWnd.SetActiveWindow... | 2 | 2009-12-01T03:12:07Z | 2,004,267 | <p>Here is a working module that calls user32.SendInput().</p>
<p>Not perfect, but usable.</p>
<p>Edit: </p>
<p>Yesterday I did a version with a class, and am using it in a working tkinter app. Will put it here when i get time to clean it up.</p>
<p>Have added this in the doc string below:</p>
<p>[ It is OK if I w... | 8 | 2010-01-05T05:03:38Z | [
"python",
"sendkeys"
] |
SendKeys for Python 3.1 on Windows | 1,823,762 | <p>The latest Python Sendkeys module is for Python 2.6. I can't upgrade it myself as it needs the C module to be recompiled.</p>
<p>Does anyone know of a fairly easy alternative way to send keys to a window?</p>
<p>Using win32ui.FindWindow() I can find the right window, then make it active with PyCWnd.SetActiveWindow... | 2 | 2009-12-01T03:12:07Z | 6,112,025 | <p>I rewrote the C bits of sendkeys in ctypes a while ago...
<a href="https://bitbucket.org/markm/sendkeysctypes" rel="nofollow">https://bitbucket.org/markm/sendkeysctypes</a>
and I see someone else did it too:
<a href="http://code.google.com/p/sendkeys-ctypes/" rel="nofollow">http://code.google.com/p/sendkeys-ctypes/... | 4 | 2011-05-24T14:28:38Z | [
"python",
"sendkeys"
] |
Django best practice for displaying mostly read-only form, one field writeable | 1,823,852 | <p>I have a requirement where one user creates an 'instance' of an object via a ModelForm. Another user of a different group has access to read all of the fields of the form, but has to update only one field. Think of a student who creates an exam object. Then a teach pulls up the exam and just needs to put in a grade,... | 2 | 2009-12-01T03:43:58Z | 1,824,011 | <blockquote>
<p>Should I just query for the object, and display each field individually, then create a form (not a ModelForm?) for just the one field?</p>
</blockquote>
<p>This is probably the best way to go about it. Note you <strong>can</strong> use a <code>ModelForm</code> for the teacher form, see the Django doc... | 3 | 2009-12-01T04:32:31Z | [
"python",
"django"
] |
Overload a method with a function at runtime | 1,823,898 | <p>OK, I'll admit upfront this is a mega kludge and that I could definately implement this better. It's only morbid curiosity that's driving me to find out how I could do this.</p>
<pre><code>class SomeClass(object):
def __init__(self):
def __(self, arg):
self.doStuff(arg)
self.overLoad... | 4 | 2009-12-01T03:53:55Z | 1,823,904 | <p>The issue is that you are trying to add a new <em>instance method</em> (not class method) and it is not binding properly. Python has a module function to manually bind functions to instances.</p>
<pre><code>import new
self.method = new.instancemethod(func, self, class)
</code></pre>
<p>Edit: Apparently the <code>... | 3 | 2009-12-01T03:55:59Z | [
"python",
"metaprogramming"
] |
Overload a method with a function at runtime | 1,823,898 | <p>OK, I'll admit upfront this is a mega kludge and that I could definately implement this better. It's only morbid curiosity that's driving me to find out how I could do this.</p>
<pre><code>class SomeClass(object):
def __init__(self):
def __(self, arg):
self.doStuff(arg)
self.overLoad... | 4 | 2009-12-01T03:53:55Z | 1,823,925 | <p>Don't worry about the self parameter, the function already has that from local scope.</p>
<pre><code>class SomeClass(object):
def __init__(self):
def __(arg):
self.bar(arg)
self.foo = __
def foo(self, arg):
print "foo", arg
def bar(self, arg):
print "bar", arg... | 8 | 2009-12-01T04:02:44Z | [
"python",
"metaprogramming"
] |
Overload a method with a function at runtime | 1,823,898 | <p>OK, I'll admit upfront this is a mega kludge and that I could definately implement this better. It's only morbid curiosity that's driving me to find out how I could do this.</p>
<pre><code>class SomeClass(object):
def __init__(self):
def __(self, arg):
self.doStuff(arg)
self.overLoad... | 4 | 2009-12-01T03:53:55Z | 1,828,585 | <p>sj26's solution is a good one. Another alternative, if you want to set up a method that can be overloaded with any user-supplied function or with another of the object's methods, is build a custom descriptor. This descriptor can be used as a decorator (analogous to @classmethod or @staticmethod); and it allows you... | 0 | 2009-12-01T20:13:17Z | [
"python",
"metaprogramming"
] |
Self import of subpackages or not? | 1,824,001 | <p>Suppose you have the following </p>
<pre><code>b
b/__init__.py
b/c
b/c/__init__.py
b/c/d
b/c/d/__init__.py
</code></pre>
<p>In some python packages, if you <code>import b</code>, you only get the symbols defined in b. To access b.c, you have to explicitly <code>import b.c</code> or <code>from b import c</code>. In... | 5 | 2009-12-01T04:29:43Z | 1,824,050 | <p>I like namespaces -- so I think that <code>import b</code> should only get what's in <code>b</code> itself (presumably in <code>b/__init__.py</code>). If there's a reason to segregate other functionality in <code>b.c</code>, <code>b.c.d</code>, or whatever, then just <code>import b</code> should not drag it all in ... | 5 | 2009-12-01T04:44:19Z | [
"python",
"packages"
] |
Self import of subpackages or not? | 1,824,001 | <p>Suppose you have the following </p>
<pre><code>b
b/__init__.py
b/c
b/c/__init__.py
b/c/d
b/c/d/__init__.py
</code></pre>
<p>In some python packages, if you <code>import b</code>, you only get the symbols defined in b. To access b.c, you have to explicitly <code>import b.c</code> or <code>from b import c</code>. In... | 5 | 2009-12-01T04:29:43Z | 1,825,040 | <p><code>__all__</code> = [your vars, functions, classes]</p>
<p>Use syntax above in package b's <code>__init__.py</code> to auto load things listed in dict. :)</p>
| 0 | 2009-12-01T09:33:28Z | [
"python",
"packages"
] |
How do I query XHTML using python? | 1,824,057 | <p>I have created a simple test harness in python for my ASP .net web site. </p>
<p>I would like to look up some HTML tags in the resulting page to find certain values.\</p>
<p>What would be the best way of doing this in python?</p>
<p>eg (returned page):</p>
<pre><code><div id="ErrorPanel">An error occurred.... | 1 | 2009-12-01T04:45:29Z | 1,824,071 | <p>Do you want to parse XML, as you state in your question's title, or HTML, as you show in the text of the question? For the latter, I recommend <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">BeautifulSoup</a> -- download it and install it, then, once having made a <code>soup</code> object out... | 4 | 2009-12-01T04:52:00Z | [
"python",
"html"
] |
How do I query XHTML using python? | 1,824,057 | <p>I have created a simple test harness in python for my ASP .net web site. </p>
<p>I would like to look up some HTML tags in the resulting page to find certain values.\</p>
<p>What would be the best way of doing this in python?</p>
<p>eg (returned page):</p>
<pre><code><div id="ErrorPanel">An error occurred.... | 1 | 2009-12-01T04:45:29Z | 1,824,386 | <p>You can also do it with <a href="http://lxml.de/" rel="nofollow">lxml</a>. It <a href="http://lxml.de/lxmlhtml.html" rel="nofollow">handles HTML</a> <a href="http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciated-web-scraping-library/" rel="nofollow">very well</a>, and you can use <a href="http://lxml.de/css... | 4 | 2009-12-01T06:36:39Z | [
"python",
"html"
] |
urllib2 not retrieving entire HTTP response | 1,824,069 | <p>I'm perplexed as to why I'm not able to download the entire contents of some JSON responses from <a href="http://friendfeed.com/">FriendFeed</a> using <a href="http://docs.python.org/library/urllib2.html">urllib2</a>.</p>
<pre><code>>>> import urllib2
>>> stream = urllib2.urlopen('http://friendfee... | 12 | 2009-12-01T04:51:24Z | 1,824,074 | <p>Keep calling stream.read() until it's done...</p>
<pre><code>while data = stream.read() :
... do stuff with data
</code></pre>
| 2 | 2009-12-01T04:54:09Z | [
"python",
"http",
"urllib2"
] |
urllib2 not retrieving entire HTTP response | 1,824,069 | <p>I'm perplexed as to why I'm not able to download the entire contents of some JSON responses from <a href="http://friendfeed.com/">FriendFeed</a> using <a href="http://docs.python.org/library/urllib2.html">urllib2</a>.</p>
<pre><code>>>> import urllib2
>>> stream = urllib2.urlopen('http://friendfee... | 12 | 2009-12-01T04:51:24Z | 1,824,094 | <pre><code>readlines()
</code></pre>
<p>also works</p>
| 0 | 2009-12-01T05:03:03Z | [
"python",
"http",
"urllib2"
] |
urllib2 not retrieving entire HTTP response | 1,824,069 | <p>I'm perplexed as to why I'm not able to download the entire contents of some JSON responses from <a href="http://friendfeed.com/">FriendFeed</a> using <a href="http://docs.python.org/library/urllib2.html">urllib2</a>.</p>
<pre><code>>>> import urllib2
>>> stream = urllib2.urlopen('http://friendfee... | 12 | 2009-12-01T04:51:24Z | 1,824,147 | <p>Best way to get all of the data:</p>
<pre><code>fp = urllib2.urlopen("http://www.example.com/index.cfm")
response = ""
while 1:
data = fp.read()
if not data: # This might need to be if data == "": -- can't remember
break
response += data
print response
</code></pre>
<p>The reason... | 17 | 2009-12-01T05:25:21Z | [
"python",
"http",
"urllib2"
] |
urllib2 not retrieving entire HTTP response | 1,824,069 | <p>I'm perplexed as to why I'm not able to download the entire contents of some JSON responses from <a href="http://friendfeed.com/">FriendFeed</a> using <a href="http://docs.python.org/library/urllib2.html">urllib2</a>.</p>
<pre><code>>>> import urllib2
>>> stream = urllib2.urlopen('http://friendfee... | 12 | 2009-12-01T04:51:24Z | 4,268,012 | <p>Use <a href="http://www.tcpdump.org/" rel="nofollow">tcpdump</a> (or something like it) to monitor the actual network interactions - then you can analyze why the site is broken for some client libraries. Ensure that you repeat multiple times by scripting the test, so you can see if the problem is consistent:</p>
<p... | 4 | 2010-11-24T14:43:30Z | [
"python",
"http",
"urllib2"
] |
Get mach_absolute_time/UpTime() in nanoseconds in Python | 1,824,399 | <p>I need to access the elapsed time since startup in nanoseconds from a Python program running on Mac OS X 10.6.</p>
<p>I use the following Carbon calls to get this in C code:</p>
<pre><code>AbsoluteTime uptimeAbs = AbsoluteToNanoseconds(UpTime());
uint64_t elapsedTime = ((uint64_t)uptimeAbs.hi << 32) + uptime... | 2 | 2009-12-01T06:41:25Z | 1,824,461 | <p>Within the code in one of the answers at <a href="http://stackoverflow.com/questions/1597383/cgeventtimestamp-to-nsdate">http://stackoverflow.com/questions/1597383/cgeventtimestamp-to-nsdate</a>, I found -[NSProcessInfo systemUptime], available starting in 10.6. This gives me the time in decimal seconds, which I can... | 2 | 2009-12-01T07:00:37Z | [
"python",
"osx",
"carbon",
"pyobjc"
] |
major changes in python since version 2.2.3 | 1,824,417 | <p>I've written a small python script to create a file and calculate times. I've tested it on Fedora 10, and Ubuntu 8.x and it worked well. the python versions were 2.5.x.</p>
<p>I tried to run it on my production server (an old red hat based linux server), the version of python is 2.2.3. the script does not work and ... | 3 | 2009-12-01T06:49:25Z | 1,824,435 | <p>I wrote a script a while ago to help answer this exact question: <a href="http://github.com/ghewgill/pyqver" rel="nofollow">pyqver</a>. </p>
<blockquote>
<p>This script attempts to identify the minimum version of Python that is required
to execute a particular source file.</p>
<p>When developing Python scr... | 8 | 2009-12-01T06:53:34Z | [
"python",
"changelog"
] |
major changes in python since version 2.2.3 | 1,824,417 | <p>I've written a small python script to create a file and calculate times. I've tested it on Fedora 10, and Ubuntu 8.x and it worked well. the python versions were 2.5.x.</p>
<p>I tried to run it on my production server (an old red hat based linux server), the version of python is 2.2.3. the script does not work and ... | 3 | 2009-12-01T06:49:25Z | 1,824,451 | <p>That's weird, because it compiles if you remove the <code>()</code> in the class definition. However, the <a href="http://www.python.org/doc/2.2/ref/class.html#tok-inheritance" rel="nofollow">documentation</a> says that empty parens there is ok.</p>
<p>Since you're using lots of python 2.5 features, it's going to b... | 1 | 2009-12-01T06:58:22Z | [
"python",
"changelog"
] |
major changes in python since version 2.2.3 | 1,824,417 | <p>I've written a small python script to create a file and calculate times. I've tested it on Fedora 10, and Ubuntu 8.x and it worked well. the python versions were 2.5.x.</p>
<p>I tried to run it on my production server (an old red hat based linux server), the version of python is 2.2.3. the script does not work and ... | 3 | 2009-12-01T06:49:25Z | 1,824,453 | <p><a href="http://www.python.org/doc/versions/" rel="nofollow">This page</a> links to all the Python version docs - look for the "What's New in Python X.X" doc that Andrew Kuchling has been diligently writing for each release.</p>
<p>Off-hand, I would guess the problem is the empty ()'s in your class definition, but ... | 1 | 2009-12-01T06:59:32Z | [
"python",
"changelog"
] |
major changes in python since version 2.2.3 | 1,824,417 | <p>I've written a small python script to create a file and calculate times. I've tested it on Fedora 10, and Ubuntu 8.x and it worked well. the python versions were 2.5.x.</p>
<p>I tried to run it on my production server (an old red hat based linux server), the version of python is 2.2.3. the script does not work and ... | 3 | 2009-12-01T06:49:25Z | 1,824,483 | <p>My money is on new-style classes, which the <code>()</code> on your class would imply.</p>
| 1 | 2009-12-01T07:07:09Z | [
"python",
"changelog"
] |
major changes in python since version 2.2.3 | 1,824,417 | <p>I've written a small python script to create a file and calculate times. I've tested it on Fedora 10, and Ubuntu 8.x and it worked well. the python versions were 2.5.x.</p>
<p>I tried to run it on my production server (an old red hat based linux server), the version of python is 2.2.3. the script does not work and ... | 3 | 2009-12-01T06:49:25Z | 1,824,636 | <p>The ternary operator is quite new. There are a few alternatives but I'd write it like this:</p>
<pre><code>if size is None:
size = self._size
else:
size = long(size)
</code></pre>
| 0 | 2009-12-01T07:55:47Z | [
"python",
"changelog"
] |
Inheriting specific parent model attributes in foreignkey->'self' relationship in Django | 1,824,667 | <p>I have a Django model:</p>
<pre><code>class Foo(models.Model):
name = models.CharField(unique=True)
attribute1 = models.FloatField(null=True, blank=True)
attribute2 = models.FloatField(null=True, blank=True)
attribute3 = models.BooleanField(null=True, blank=True)
attribute4 = models.CharField(nu... | 2 | 2009-12-01T08:04:10Z | 1,824,907 | <p>Perhaps the <code>__getattr__</code> and <code>__setattr__</code> are a good choice here.</p>
<pre><code>class Foo(models.Model):
name = models.CharField(unique=True)
inherit = models.ForeignKey('self', related_name='children', null=True, blank=True)
_attribute1 = models.FloatField(null=True, blank=Tru... | 2 | 2009-12-01T09:04:30Z | [
"python",
"django",
"django-models"
] |
Inheriting specific parent model attributes in foreignkey->'self' relationship in Django | 1,824,667 | <p>I have a Django model:</p>
<pre><code>class Foo(models.Model):
name = models.CharField(unique=True)
attribute1 = models.FloatField(null=True, blank=True)
attribute2 = models.FloatField(null=True, blank=True)
attribute3 = models.BooleanField(null=True, blank=True)
attribute4 = models.CharField(nu... | 2 | 2009-12-01T08:04:10Z | 1,824,926 | <p>You could use a Descriptor:</p>
<pre><code>class InheritedAttribute(object):
def __init__(self, name):
self.attname = '_' + name
def __get__(self, instance, owner):
if instance.inherit:
return getattr(instance.inherit, self.attname)
else:
return getattr(insta... | 0 | 2009-12-01T09:08:39Z | [
"python",
"django",
"django-models"
] |
Inheriting specific parent model attributes in foreignkey->'self' relationship in Django | 1,824,667 | <p>I have a Django model:</p>
<pre><code>class Foo(models.Model):
name = models.CharField(unique=True)
attribute1 = models.FloatField(null=True, blank=True)
attribute2 = models.FloatField(null=True, blank=True)
attribute3 = models.BooleanField(null=True, blank=True)
attribute4 = models.CharField(nu... | 2 | 2009-12-01T08:04:10Z | 1,828,055 | <p>You could use <a href="http://docs.djangoproject.com/en/dev/topics/signals/" rel="nofollow">Signals</a> to generate accessor-method, as shown <a href="http://stackoverflow.com/questions/550632/favorite-django-tips-features/1407331#1407331">here</a> </p>
| 0 | 2009-12-01T18:41:37Z | [
"python",
"django",
"django-models"
] |
Inheriting specific parent model attributes in foreignkey->'self' relationship in Django | 1,824,667 | <p>I have a Django model:</p>
<pre><code>class Foo(models.Model):
name = models.CharField(unique=True)
attribute1 = models.FloatField(null=True, blank=True)
attribute2 = models.FloatField(null=True, blank=True)
attribute3 = models.BooleanField(null=True, blank=True)
attribute4 = models.CharField(nu... | 2 | 2009-12-01T08:04:10Z | 10,866,837 | <p>I had a similar problem. The goal was to have a class that allowed for certain fields to take on the value of the group. The code below introduces these features to your model:</p>
<ol>
<li>If you want to make a field inherit the group value, you only have to create another BooleanField with the name "inherit_group... | 0 | 2012-06-02T23:55:24Z | [
"python",
"django",
"django-models"
] |
Python QtreeWidget: return tree hierarchy | 1,824,735 | <p>I got stuck in trying to obtain the hierarchical view of a widget tree.</p>
<p>The code works fine and generates a nice tree like that:</p>
<pre><code>ROOT(Animal):
|
|
|___Not extinct:
. | (red)
. |_____BIRD--------------(blue)
. | (green)
... | 0 | 2009-12-01T08:22:36Z | 1,824,929 | <p>What about a method in each QtreeWidgetItem in which you could print the path to this item.</p>
<p>In this method, you could use recursion to get the complete path of the item's parents (you have a "QTreeWidgetItem * parent () const" method to do this) and you add the current item's text to its parent's path ! You ... | 2 | 2009-12-01T09:09:30Z | [
"python",
"qt",
"treeview",
"pyqt",
"hierarchy"
] |
Infinity generated in python code | 1,824,751 | <p>I'm looking over some complex Python 2.6 code which is occasionally resulting in an infinity being generated (at least an Infinity being serialized by the json library -- which checks w/ math.isinf).</p>
<p>What is especially baffling is that Python (as far as I can tell) shouldn't be able to ever produce computati... | 6 | 2009-12-01T08:27:15Z | 1,824,777 | <p>Somewhere between 1e308 and 1e309 the floats run out of precision, so if you are computing results above that range you will see inf</p>
<pre><code>>>> 1e308
1e+308
>>> 1e309
inf
>>> json.dumps(1e308,allow_nan=False)
'1e+308'
>>> json.dumps(1e309,allow_nan=False)
Traceback (most... | 12 | 2009-12-01T08:33:54Z | [
"python",
"infinity"
] |
Is it possible for my linux machine (with no GUI) to hit Twitter sign up page, and then spit out a captcha in a webpage format | 1,825,186 | <p>So that I can just type in the letters and register (through my linux box's IP)?</p>
<p>(twitter uses recaptcha) </p>
<p>Is there some way to grab that javascript, output it into a webpage. Then submit it through?</p>
| 0 | 2009-12-01T10:00:00Z | 1,825,214 | <p>Twitter offers a special <a href="http://apiwiki.twitter.com/" rel="nofollow">API for services</a>. Use that to automatically login from one of your programs to post tweets.</p>
| 3 | 2009-12-01T10:06:04Z | [
"python",
"http",
"forms",
"twitter",
"captcha"
] |
Can I combine two 'findAll' search blocks in beautifulsoup, into one? | 1,825,187 | <p>Can I combine these two blocks into one:</p>
<p>Edit: Any other method than combining loops like Yacoby did in the answer.</p>
<pre><code>for tag in soup.findAll(['script', 'form']):
tag.extract()
for tag in soup.findAll(id="footer"):
tag.extract()
</code></pre>
<p>Also can I multiple blocks into one:</p... | 1 | 2009-12-01T10:00:02Z | 1,825,211 | <p>I don't know if BeautifulSoup can do it more elegantly, but you could merge the two loops like so:</p>
<pre><code>for tag in soup.findAll(['script', 'form']) + soup.findAll(id="footer"):
tag.extract()
</code></pre>
<p>You can find classes like so (<a href="http://www.crummy.com/software/BeautifulSoup/documenta... | 4 | 2009-12-01T10:05:26Z | [
"python",
"beautifulsoup"
] |
Can I combine two 'findAll' search blocks in beautifulsoup, into one? | 1,825,187 | <p>Can I combine these two blocks into one:</p>
<p>Edit: Any other method than combining loops like Yacoby did in the answer.</p>
<pre><code>for tag in soup.findAll(['script', 'form']):
tag.extract()
for tag in soup.findAll(id="footer"):
tag.extract()
</code></pre>
<p>Also can I multiple blocks into one:</p... | 1 | 2009-12-01T10:00:02Z | 1,825,231 | <p>The answer to the second part of your question is <em>right there</em> in the <a href="http://www.crummy.com/software/BeautifulSoup/documentation.html#The%20basic%20find%20method%3A%20findAll%28name,%20attrs,%20recursive,%20text,%20limit,%20%2A%2Akwargs%29" rel="nofollow">documentation</a>:</p>
<blockquote>
<p><s... | 0 | 2009-12-01T10:09:45Z | [
"python",
"beautifulsoup"
] |
Can I combine two 'findAll' search blocks in beautifulsoup, into one? | 1,825,187 | <p>Can I combine these two blocks into one:</p>
<p>Edit: Any other method than combining loops like Yacoby did in the answer.</p>
<pre><code>for tag in soup.findAll(['script', 'form']):
tag.extract()
for tag in soup.findAll(id="footer"):
tag.extract()
</code></pre>
<p>Also can I multiple blocks into one:</p... | 1 | 2009-12-01T10:00:02Z | 1,825,365 | <p>You can pass functions to <code>.findall()</code> like this:</p>
<pre><code>soup.findAll(lambda tag: tag.name in ['script', 'form'] or tag['id'] == "footer")
</code></pre>
<p>But you might be better off by first building a list of tags and then iterating over it:</p>
<pre><code>tags = soup.findAll(['script', 'for... | 6 | 2009-12-01T10:41:37Z | [
"python",
"beautifulsoup"
] |
Mark string as safe in Mako | 1,825,343 | <p>I'm using Pylons with Mako templates and I want to avoid typing this all the time:</p>
<pre><code>${ h.some_function_that_outputs_html() | n }
</code></pre>
<p>I want to somehow mark the function, or a variable as safe (you can do that in Django) so I don't have to pipe-en all the time. Any ideas? </p>
| 11 | 2009-12-01T10:36:30Z | 1,828,776 | <p>According to the <a href="http://www.makotemplates.org/docs/filtering.html" rel="nofollow">mako docs about filtering</a>, you can set the default filters that are applied inside templates when creating a new <code>Template</code> as well as for the <code>TemplateLookup</code> (in which case this would apply by defau... | 3 | 2009-12-01T20:41:03Z | [
"python",
"pylons",
"mako"
] |
Mark string as safe in Mako | 1,825,343 | <p>I'm using Pylons with Mako templates and I want to avoid typing this all the time:</p>
<pre><code>${ h.some_function_that_outputs_html() | n }
</code></pre>
<p>I want to somehow mark the function, or a variable as safe (you can do that in Django) so I don't have to pipe-en all the time. Any ideas? </p>
| 11 | 2009-12-01T10:36:30Z | 1,859,850 | <p>I just found out that if you put a <strong>html</strong> method in your class, then Mako will just call that method and output whatever it returns in the template.</p>
<p>So I did:</p>
<pre><code>def __html__(self):
return unicode(self)
</code></pre>
<p>That's basically what h.literal does.</p>
| 10 | 2009-12-07T13:05:10Z | [
"python",
"pylons",
"mako"
] |
Using super() in nested classes | 1,825,384 | <p>Imagine this:</p>
<pre><code>class A(object):
class B(object):
def __init__(self):
super(B, self).__init__()
</code></pre>
<p>This creates an error:</p>
<pre>
NameError: global name B is not defined.
</pre>
<p>I've tried <code>A.B</code>, but then it says that <code>A</code> is not define... | 17 | 2009-12-01T10:47:22Z | 1,825,443 | <p>Since B will likely never be extended itself, this should work:</p>
<pre><code>class A(object):
class B(object):
def __init__(self):
super(self.__class__, self).__init__()
</code></pre>
| 4 | 2009-12-01T10:58:58Z | [
"python",
"super"
] |
Using super() in nested classes | 1,825,384 | <p>Imagine this:</p>
<pre><code>class A(object):
class B(object):
def __init__(self):
super(B, self).__init__()
</code></pre>
<p>This creates an error:</p>
<pre>
NameError: global name B is not defined.
</pre>
<p>I've tried <code>A.B</code>, but then it says that <code>A</code> is not define... | 17 | 2009-12-01T10:47:22Z | 1,825,470 | <p>I'm not sure why A.B is not working correctly for you, as it should.. Here's some shell output that works:</p>
<pre><code>>>> class A(object):
... class B(object):
... def __init__(self):
... super(A.B, self).__init__()
... def getB(self):
... return A.B()
...
>>> A().getB()
<... | 15 | 2009-12-01T11:04:30Z | [
"python",
"super"
] |
Using super() in nested classes | 1,825,384 | <p>Imagine this:</p>
<pre><code>class A(object):
class B(object):
def __init__(self):
super(B, self).__init__()
</code></pre>
<p>This creates an error:</p>
<pre>
NameError: global name B is not defined.
</pre>
<p>I've tried <code>A.B</code>, but then it says that <code>A</code> is not define... | 17 | 2009-12-01T10:47:22Z | 1,828,214 | <p>If the class A.B is unlikely to participate in any multiple inheritance, then you're better off just hard-coding the constructor call:</p>
<pre><code>class A(object):
class B(object):
def __init__(self):
object.__init__(self)
</code></pre>
<p>But if you really do need to have the full power... | 2 | 2009-12-01T19:10:13Z | [
"python",
"super"
] |
Download html page and its content | 1,825,438 | <p>Does python have any way of downloading entire html page and its contents (images, css) to local folder given a url. And updating local html file to pick content locally.</p>
| 23 | 2009-12-01T10:58:09Z | 1,825,455 | <p>You can use the urlib:</p>
<pre><code>import urllib.request
opener = urllib.request.FancyURLopener({})
url = "http://stackoverflow.com/"
f = opener.open(url)
content = f.read()
</code></pre>
| 2 | 2009-12-01T11:00:21Z | [
"python",
"html"
] |
Download html page and its content | 1,825,438 | <p>Does python have any way of downloading entire html page and its contents (images, css) to local folder given a url. And updating local html file to pick content locally.</p>
| 23 | 2009-12-01T10:58:09Z | 1,825,465 | <p>You can use the <a href="http://docs.python.org/library/urllib.html"><code>urllib</code></a> module to download individual URLs but this will just return the data. It will not parse the HTML and automatically download things like CSS files and images.</p>
<p>If you want to download the "whole" page you will need t... | 20 | 2009-12-01T11:02:16Z | [
"python",
"html"
] |
Download html page and its content | 1,825,438 | <p>Does python have any way of downloading entire html page and its contents (images, css) to local folder given a url. And updating local html file to pick content locally.</p>
| 23 | 2009-12-01T10:58:09Z | 1,825,727 | <p>What you're looking for is a mirroring tool. If you want one in Python, PyPI lists <a href="http://pypi.python.org/pypi/spider.py/0.5">spider.py</a> but I have no experience with it. Others might be better but I don't know - I use 'wget', which supports <a href="http://wget.addictivecode.org/FrequentlyAskedQuestions... | 6 | 2009-12-01T11:59:01Z | [
"python",
"html"
] |
Inheriting methods from a metaclass | 1,825,544 | <p>In the example enumeration code given in <a href="http://stackoverflow.com/questions/855941/subclassing-ctypes-python">this question</a>, reproduced below, why does <code>TOKEN</code> contain the implementations of <code>__contains__</code> and <code>__repr__</code> from the metaclass <code>EnumerationType</code>?</... | 2 | 2009-12-01T11:21:47Z | 1,825,635 | <p>Both <code>Enumeration</code> and <code>TOKEN</code> are instances of <code>EnumerationType</code>:</p>
<pre><code>>>> isinstance(Enumeration, EnumerationType)
True
>>> isinstance(TOKEN, EnumerationType)
True
</code></pre>
<p>And <a href="http://docs.python.org/reference/datamodel.html#special-me... | 2 | 2009-12-01T11:42:16Z | [
"python",
"metaclass"
] |
Can python send text to the Mac clipboard | 1,825,692 | <p>I'd like my python program to place some text in the Mac clipboard.</p>
<p>Is this possible?</p>
| 20 | 2009-12-01T11:51:49Z | 1,825,723 | <p><strong>New answer:</strong></p>
<p><a href="http://www.devx.com/opensource/Article/37233/0/page/3">This page</a> suggests: </p>
<blockquote>
<p><strong>Implementation for All Mac OS X
Versions</strong></p>
<p>The other Mac module
(MacSharedClipboard.py, in Listing 4)
implements the clipboard interfac... | 8 | 2009-12-01T11:58:46Z | [
"python",
"osx",
"clipboard"
] |
Can python send text to the Mac clipboard | 1,825,692 | <p>I'd like my python program to place some text in the Mac clipboard.</p>
<p>Is this possible?</p>
| 20 | 2009-12-01T11:51:49Z | 3,555,675 | <p>The following code use PyObjC (http://pyobjc.sourceforge.net/)</p>
<pre><code>from AppKit import NSPasteboard, NSArray
pb = NSPasteboard.generalPasteboard()
pb.clearContents()
a = NSArray.arrayWithObject_("hello world")
pb.writeObjects_(a)
</code></pre>
<p>As <a href="http://developer.apple.com/mac/library/docume... | 14 | 2010-08-24T10:55:48Z | [
"python",
"osx",
"clipboard"
] |
Can python send text to the Mac clipboard | 1,825,692 | <p>I'd like my python program to place some text in the Mac clipboard.</p>
<p>Is this possible?</p>
| 20 | 2009-12-01T11:51:49Z | 6,888,324 | <p>if you just wanted to put text into the mac clipboard, you could use the shell's pbcopy command.</p>
| 2 | 2011-07-31T08:21:01Z | [
"python",
"osx",
"clipboard"
] |
Can python send text to the Mac clipboard | 1,825,692 | <p>I'd like my python program to place some text in the Mac clipboard.</p>
<p>Is this possible?</p>
| 20 | 2009-12-01T11:51:49Z | 9,346,957 | <p>A simple way:</p>
<pre><code>cmd = 'echo %s | tr -d "\n" | pbcopy' % str
os.system(cmd)
</code></pre>
<p>A cross-platform way:<br />
<a href="http://stackoverflow.com/a/4203897/805627">http://stackoverflow.com/a/4203897/805627</a></p>
<pre><code>from Tkinter import Tk
r = Tk()
r.withdraw()
r.clipboard_clear()
r.c... | 11 | 2012-02-19T05:21:07Z | [
"python",
"osx",
"clipboard"
] |
Can python send text to the Mac clipboard | 1,825,692 | <p>I'd like my python program to place some text in the Mac clipboard.</p>
<p>Is this possible?</p>
| 20 | 2009-12-01T11:51:49Z | 25,802,742 | <p>How to write a Unicode string to the Mac clipboard:</p>
<pre><code>import subprocess
def write_to_clipboard(output):
process = subprocess.Popen(
'pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE)
process.communicate(output.encode('utf-8'))
</code></pre>
<p>How to read a Unicode string f... | 30 | 2014-09-12T07:12:39Z | [
"python",
"osx",
"clipboard"
] |
Can python send text to the Mac clipboard | 1,825,692 | <p>I'd like my python program to place some text in the Mac clipboard.</p>
<p>Is this possible?</p>
| 20 | 2009-12-01T11:51:49Z | 32,386,099 | <p>I know this is an older post, but I have found a very elegant solution to this problem.</p>
<p>There is a library named <em>PyClip</em>, which can be found at <a href="https://github.com/georgefs/pyclip-copycat" rel="nofollow">https://github.com/georgefs/pyclip-copycat</a>.</p>
<p>The syntax is pretty simple (exam... | 3 | 2015-09-03T21:58:44Z | [
"python",
"osx",
"clipboard"
] |
How to pack and unpack using ctypes (Structure <-> str) | 1,825,715 | <p>This might be a silly question but I couldn't find a good answer in the docs or anywhere.</p>
<p>If I use <strong>struct</strong> to define a binary structure, the struct has 2 symmetrical methods for serialization and deserialization (pack and unpack) but it seems <strong>ctypes</strong> doesn't have a straightfor... | 28 | 2009-12-01T11:57:23Z | 1,827,666 | <p><a href="http://wiki.python.org/moin/ctypes">The PythonInfo wiki</a> has a solution for this.</p>
<blockquote>
<p>FAQ: How do I copy bytes to Python from a ctypes.Structure?</p>
<pre><code>def send(self):
return buffer(self)[:]
</code></pre>
<p>FAQ: How do I copy bytes to a ctypes.Structure from Python?... | 19 | 2009-12-01T17:24:38Z | [
"python",
"struct",
"ctypes"
] |
How to pack and unpack using ctypes (Structure <-> str) | 1,825,715 | <p>This might be a silly question but I couldn't find a good answer in the docs or anywhere.</p>
<p>If I use <strong>struct</strong> to define a binary structure, the struct has 2 symmetrical methods for serialization and deserialization (pack and unpack) but it seems <strong>ctypes</strong> doesn't have a straightfor... | 28 | 2009-12-01T11:57:23Z | 1,972,348 | <p>Have a look at this link on binary i/o in python:</p>
<p><a href="http://www.dabeaz.com/blog/2009/08/python-binary-io-handling.html" rel="nofollow">http://www.dabeaz.com/blog/2009/08/python-binary-io-handling.html</a></p>
<p>Based on this you can simply write the following to read from a buffer (not just files):</... | 14 | 2009-12-29T00:40:59Z | [
"python",
"struct",
"ctypes"
] |
django admin permissions - can edit user but can't edit his permissons - how to do it? | 1,825,771 | <p>I gave the editors such permissions:</p>
<ul>
<li><p>auth | user | can add/change user - ON</p></li>
<li><p>auth | permissions | can add/change permissions - OFF</p></li>
</ul>
<p>Still, when editing, they can change their permissions (and allow themselves actions they shouldn't do). I've found a ticket from 2yrs ... | 1 | 2009-12-01T12:06:55Z | 1,827,082 | <p>Your current approach isn't going to work I'm afraid.</p>
<p>From the <a href="http://docs.djangoproject.com/en/dev/topics/auth/#creating-users" rel="nofollow">Django docs</a>:</p>
<blockquote>
<p>If you have permission to add users, you have the power to create superusers, which can then, in turn, change other ... | 1 | 2009-12-01T15:53:46Z | [
"python",
"django",
"permissions",
"django-admin"
] |
django admin permissions - can edit user but can't edit his permissons - how to do it? | 1,825,771 | <p>I gave the editors such permissions:</p>
<ul>
<li><p>auth | user | can add/change user - ON</p></li>
<li><p>auth | permissions | can add/change permissions - OFF</p></li>
</ul>
<p>Still, when editing, they can change their permissions (and allow themselves actions they shouldn't do). I've found a ticket from 2yrs ... | 1 | 2009-12-01T12:06:55Z | 7,396,909 | <p>The code below gives you ability to override the formset, this essentially limits the ability for non-superusers to edit permissions. They can still create users, but they just can't modify permissions. They can even edit users just fine.</p>
<pre><code>class UserAdmin(UserAdmin):
def change_view(self, request... | 1 | 2011-09-13T04:43:57Z | [
"python",
"django",
"permissions",
"django-admin"
] |
How much of NumPy and SciPy is in C? | 1,825,857 | <p>Are parts of NumPy and/or SciPy programmed in C/C++?</p>
<p>And how does the overhead of calling C from Python compare to the overhead of calling C from Java and/or C#?</p>
<p>I'm just wondering if Python is a better option than Java or C# for scientific apps.</p>
<p>If I look at the <a href="http://shootout.alio... | 7 | 2009-12-01T12:21:20Z | 1,825,950 | <ol>
<li><s>I would question any benchmark which doesn't show the source for each implementation (or did I miss something)? It's entirely possible that either or both of those solutions are coded badly which would result in an unfair appraisal of either or both language's performance.</s> <strong>[Edit]</strong> Oops, ... | 11 | 2009-12-01T12:39:25Z | [
"python",
"performance",
"numpy",
"scipy",
"scientific-computing"
] |
How much of NumPy and SciPy is in C? | 1,825,857 | <p>Are parts of NumPy and/or SciPy programmed in C/C++?</p>
<p>And how does the overhead of calling C from Python compare to the overhead of calling C from Java and/or C#?</p>
<p>I'm just wondering if Python is a better option than Java or C# for scientific apps.</p>
<p>If I look at the <a href="http://shootout.alio... | 7 | 2009-12-01T12:21:20Z | 1,826,396 | <p>A lot of it is written in C or fortran. You can re-write the hot loops in C (or use one of the gazillion ways to speed python up, boost/weave is my favorite), but does it really matter?</p>
<p>Your scientific app will be run once. The rest is just debugging and development, and those can be much quicker on Python.<... | 5 | 2009-12-01T14:07:50Z | [
"python",
"performance",
"numpy",
"scipy",
"scientific-computing"
] |
How much of NumPy and SciPy is in C? | 1,825,857 | <p>Are parts of NumPy and/or SciPy programmed in C/C++?</p>
<p>And how does the overhead of calling C from Python compare to the overhead of calling C from Java and/or C#?</p>
<p>I'm just wondering if Python is a better option than Java or C# for scientific apps.</p>
<p>If I look at the <a href="http://shootout.alio... | 7 | 2009-12-01T12:21:20Z | 1,834,347 | <p>There is a better comparison <a href="http://www.scipy.org/PerformancePython" rel="nofollow">here</a> (not a benchmark but shows ways of speeding up Python). NumPy is mostly written in C. The main advantage of Python is that there are a number of ways of <em>very</em> easily extending your code with C (ctypes, swig,... | 4 | 2009-12-02T17:05:30Z | [
"python",
"performance",
"numpy",
"scipy",
"scientific-computing"
] |
How much of NumPy and SciPy is in C? | 1,825,857 | <p>Are parts of NumPy and/or SciPy programmed in C/C++?</p>
<p>And how does the overhead of calling C from Python compare to the overhead of calling C from Java and/or C#?</p>
<p>I'm just wondering if Python is a better option than Java or C# for scientific apps.</p>
<p>If I look at the <a href="http://shootout.alio... | 7 | 2009-12-01T12:21:20Z | 2,182,574 | <p>Most of NumPy is in C, but a large portion of the C code is "boilerplate" to handle all the dirty details of the Python/C interface. I think the ratio C vs. Python is around 50/50 ATM for NumPy.</p>
<p>I am not too familiar with vm-based low-level details, but I believe the interface cost would be higher because of... | 3 | 2010-02-02T08:00:41Z | [
"python",
"performance",
"numpy",
"scipy",
"scientific-computing"
] |
How much of NumPy and SciPy is in C? | 1,825,857 | <p>Are parts of NumPy and/or SciPy programmed in C/C++?</p>
<p>And how does the overhead of calling C from Python compare to the overhead of calling C from Java and/or C#?</p>
<p>I'm just wondering if Python is a better option than Java or C# for scientific apps.</p>
<p>If I look at the <a href="http://shootout.alio... | 7 | 2009-12-01T12:21:20Z | 9,164,800 | <p>It always depends on your own capability to handle the langue, so the language is able to generate fast code. Out of my experience, numpy is several times slower then good .NET implementations. And I expect JAVA to be similar fast. Their optimizing JIT compilers have improved significantly over the years and produce... | 0 | 2012-02-06T17:58:08Z | [
"python",
"performance",
"numpy",
"scipy",
"scientific-computing"
] |
Is SOAPpy the same thing as SOAPy? | 1,825,873 | <p>I would normally read the documentation to figure that out, but the links from both websites are on sourceforge and both are 404ing.</p>
| 0 | 2009-12-01T12:23:03Z | 1,825,923 | <p>They appear to be 2 separate projects. </p>
<p><strong>SOAPy</strong> was written by Adam Elman (from <a href="http://soapy.sourceforge.net/" rel="nofollow">here</a>.) </p>
<p><strong>SOAPpy</strong> was originally written by Cayce Ullman and Brian Matthews (from <a href="http://pywebsvcs.sourceforge.net/soappy.tx... | 2 | 2009-12-01T12:32:29Z | [
"python",
"soap",
"soappy"
] |
Suppress linebreak on file.write | 1,826,400 | <p>When writing to a text file, some of the file.write instances are followed by a linebreak in the output file and others aren't. I <em>don't</em> want linebreaks except where I tell them to occur. Code:</p>
<pre><code> for doc,wc in wordcounts.items():
out.write(doc) #this works fine, no linebreak... | 0 | 2009-12-01T14:08:25Z | 1,826,435 | <p>You write a line breaks after every word:</p>
<pre><code>for word in wordlist:
...
out.write("\n")
</code></pre>
<p>Are these the line breaks you are seeing, or are there more additional ones?</p>
| 1 | 2009-12-01T14:13:10Z | [
"python",
"file",
"line-breaks"
] |
Suppress linebreak on file.write | 1,826,400 | <p>When writing to a text file, some of the file.write instances are followed by a linebreak in the output file and others aren't. I <em>don't</em> want linebreaks except where I tell them to occur. Code:</p>
<pre><code> for doc,wc in wordcounts.items():
out.write(doc) #this works fine, no linebreak... | 0 | 2009-12-01T14:08:25Z | 1,826,443 | <p><code>file.write()</code> does not add any newlines if the string you write does not contain any <code>\n</code>s.</p>
<p>But you force a newline for each word in your word list using <code>out.write("\n")</code>, is that what you want?</p>
<pre><code> for doc,wc in wordcounts.items():
out.write(doc) ... | 3 | 2009-12-01T14:14:24Z | [
"python",
"file",
"line-breaks"
] |
Suppress linebreak on file.write | 1,826,400 | <p>When writing to a text file, some of the file.write instances are followed by a linebreak in the output file and others aren't. I <em>don't</em> want linebreaks except where I tell them to occur. Code:</p>
<pre><code> for doc,wc in wordcounts.items():
out.write(doc) #this works fine, no linebreak... | 0 | 2009-12-01T14:08:25Z | 1,826,470 | <p>You might need to perform a <code>strip()</code> on each <code>wc[word]</code>. Printing a single item from <code>wc</code> is would probably be enough to determine if there are already line breaks on those items that area causing this behavior. </p>
<p>Either that or the indentation on your final <code>out.write(... | 1 | 2009-12-01T14:19:45Z | [
"python",
"file",
"line-breaks"
] |
Suppress linebreak on file.write | 1,826,400 | <p>When writing to a text file, some of the file.write instances are followed by a linebreak in the output file and others aren't. I <em>don't</em> want linebreaks except where I tell them to occur. Code:</p>
<pre><code> for doc,wc in wordcounts.items():
out.write(doc) #this works fine, no linebreak... | 0 | 2009-12-01T14:08:25Z | 1,826,478 | <p>I think your indentation is wrong.</p>
<p>(also I took the liberty to make your if clause redundant and code more readable :)</p>
<pre><code>for doc,wc in wordcounts.items()
out.write(doc)
for word in wordlist:
out.write("\t%d" % wc.get(word,0))
out.write("\n")
</code></pre>
| 0 | 2009-12-01T14:21:19Z | [
"python",
"file",
"line-breaks"
] |
Passing a list to eval() | 1,826,467 | <p>Is there a way to pass a list as a function argument to eval() Or do I have to convert it to a string and then parse it as a list in the function?</p>
<p>My simple example looks like:</p>
<pre><code> eval("func1(\'" + fArgs + "\')")
</code></pre>
<p>I'm just not sure if there is a better way of taking fArgs as a ... | 0 | 2009-12-01T14:19:10Z | 1,826,480 | <p>Specifying parameters <a href="http://docs.python.org/tutorial/controlflow.html#more-on-defining-functions" rel="nofollow">the following way</a> works:</p>
<pre><code>root@parrot$ more test.py
def func1(*args):
for i in args:
print i
l = [1,'a',9.1]
func1(*l)
root@parrot$ python test.py
1
... | 2 | 2009-12-01T14:21:28Z | [
"python",
"json",
"list",
"eval"
] |
Passing a list to eval() | 1,826,467 | <p>Is there a way to pass a list as a function argument to eval() Or do I have to convert it to a string and then parse it as a list in the function?</p>
<p>My simple example looks like:</p>
<pre><code> eval("func1(\'" + fArgs + "\')")
</code></pre>
<p>I'm just not sure if there is a better way of taking fArgs as a ... | 0 | 2009-12-01T14:19:10Z | 1,826,753 | <p>If you're using Python 2.6.x, then you should be able to use the <code>json</code> module (see py doc <a href="http://docs.python.org/library/json.html">19.2</a>). If not, then there is <a href="http://pypi.python.org/pypi/python-json/">python-json</a> available through the python package index. Both of these packag... | 6 | 2009-12-01T15:01:38Z | [
"python",
"json",
"list",
"eval"
] |
Passing a list to eval() | 1,826,467 | <p>Is there a way to pass a list as a function argument to eval() Or do I have to convert it to a string and then parse it as a list in the function?</p>
<p>My simple example looks like:</p>
<pre><code> eval("func1(\'" + fArgs + "\')")
</code></pre>
<p>I'm just not sure if there is a better way of taking fArgs as a ... | 0 | 2009-12-01T14:19:10Z | 1,826,772 | <p>The others have a good point, that you shouldn't be using <code>eval</code>. But, if you must:</p>
<pre><code>eval("func1(%s)" % ", ".join(fArgs))
</code></pre>
<p>will call the function with all the arguments in the list. This:</p>
<pre><code>eval("func1([%s])" % ", ".join(fArgs))
</code></pre>
<p>will call it ... | 0 | 2009-12-01T15:03:47Z | [
"python",
"json",
"list",
"eval"
] |
Passing a list to eval() | 1,826,467 | <p>Is there a way to pass a list as a function argument to eval() Or do I have to convert it to a string and then parse it as a list in the function?</p>
<p>My simple example looks like:</p>
<pre><code> eval("func1(\'" + fArgs + "\')")
</code></pre>
<p>I'm just not sure if there is a better way of taking fArgs as a ... | 0 | 2009-12-01T14:19:10Z | 1,826,841 | <p>Using a library to parse JSON input may be a better approach than eval, something like:</p>
<pre><code>import json
func1(json.loads(fArgs))
</code></pre>
<p>Assert-ing that user input is correct would be a good idea, too.</p>
| 1 | 2009-12-01T15:16:52Z | [
"python",
"json",
"list",
"eval"
] |
The best way to join two dissimilar mySQL tables -- planning for django from python | 1,826,686 | <pre><code>table a (t_a):
id name last first email state country
0 sklass klass steve sklass@foo.com in uk
1 jabid abid john abid@foo.com ny us
2 jcolle colle john jcolle@foo.com wi us
table b (t_b):
id sn given nick email l c ... | 1 | 2009-12-01T14:52:04Z | 1,827,235 | <p>You can do this in MySQL directly via a cursor executed through a stored procedure.</p>
<pre><code>DELIMITER $$
CREATE PROCEDURE `proc_name`()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE a_id BIGINT UNSIGNED;
DECLARE b_id BIGINT UNSIGNED;
DECLARE x_count INT;
-- something like the following
DECLARE cur1 ... | 1 | 2009-12-01T16:19:02Z | [
"python",
"mysql",
"django",
"django-models"
] |
2 Axes Reportlab Graph | 1,826,761 | <p>I have managed to create a 2 axes graph in ReportLab, by overlapping a barchart and linepot. Here is the code for anyone interested in something similar:</p>
<pre><code>from reportlab.graphics.shapes import Drawing,colors
from reportlab.graphics.widgets.markers import makeMarker
from reportlab.graphics.charts.barch... | 3 | 2009-12-01T15:02:45Z | 1,829,335 | <p>I did this recently. Something like</p>
<pre><code>y2Axis.labels.dx = 10
</code></pre>
<p>should do the trick for you.</p>
| 3 | 2009-12-01T22:17:17Z | [
"python",
"graph",
"reportlab"
] |
os.kill not raising an OSError, however I do not see the given pid running | 1,826,824 | <p>On my ubuntu server I run the following command:</p>
<pre><code>python -c 'import os; os.kill(5555, 0)'
</code></pre>
<p>This is done so that I can see if pid 5555 is running. From my understanding this should raise an OSError if the pid is not running. This is not raising an OSError for me which means it should... | 3 | 2009-12-01T15:13:38Z | 1,826,935 | <p>Try installing htop (sudo apt-get install htop), it sometimes displays process that ps doesn't.</p>
| 1 | 2009-12-01T15:31:14Z | [
"python",
"ubuntu",
"pid"
] |
os.kill not raising an OSError, however I do not see the given pid running | 1,826,824 | <p>On my ubuntu server I run the following command:</p>
<pre><code>python -c 'import os; os.kill(5555, 0)'
</code></pre>
<p>This is done so that I can see if pid 5555 is running. From my understanding this should raise an OSError if the pid is not running. This is not raising an OSError for me which means it should... | 3 | 2009-12-01T15:13:38Z | 1,826,972 | <p>Maybe it's a bug in 2.5? On 2.6.4 I get:</p>
<pre><code>gruszczy@gruszczy-laptop:~$ python -c 'import os; os.kill(5555, 0)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
OSError: [Errno 3] No such process
</code></pre>
<p>I believe, there is a bug report for this:</p>
<p><a... | 1 | 2009-12-01T15:35:52Z | [
"python",
"ubuntu",
"pid"
] |
os.kill not raising an OSError, however I do not see the given pid running | 1,826,824 | <p>On my ubuntu server I run the following command:</p>
<pre><code>python -c 'import os; os.kill(5555, 0)'
</code></pre>
<p>This is done so that I can see if pid 5555 is running. From my understanding this should raise an OSError if the pid is not running. This is not raising an OSError for me which means it should... | 3 | 2009-12-01T15:13:38Z | 1,827,114 | <p>I don't know why that OSError is not raised in some cases, but it's important to note that there is a max pid value on linux and unix based OS:</p>
<pre><code>$> cat /proc/sys/kernel/pid_max
32768
</code></pre>
| 0 | 2009-12-01T15:57:30Z | [
"python",
"ubuntu",
"pid"
] |
os.kill not raising an OSError, however I do not see the given pid running | 1,826,824 | <p>On my ubuntu server I run the following command:</p>
<pre><code>python -c 'import os; os.kill(5555, 0)'
</code></pre>
<p>This is done so that I can see if pid 5555 is running. From my understanding this should raise an OSError if the pid is not running. This is not raising an OSError for me which means it should... | 3 | 2009-12-01T15:13:38Z | 1,828,286 | <p>Under linux, each process <strong>and</strong> each thread have a different pid. <code>os.kill</code> doesn't care whether you have a thread pid, or a task pid, however <code>ps</code> doesn't normally show the thread pids.</p>
<p>For instance on my machine the process with PID 8502 is running threads which you ca... | 6 | 2009-12-01T19:23:23Z | [
"python",
"ubuntu",
"pid"
] |
Outgoing load balancer | 1,827,018 | <p>I have a big threaded feed retrieval script in python.</p>
<p>My question is, how can I load balance <em>outgoing</em> requests so that I don't hit any one host too often?</p>
<p>This is a big problem for feedburner, since a large percentage of sites proxy their RSS through feedburner and to further complicate mat... | 1 | 2009-12-01T15:43:14Z | 1,827,033 | <p>If your problem is related to Feedburner "throttling you", it most certainly does this because of the source IP of your bot. The way to "load balance to Feedburner" would be to have multiple different source IPs to start from.</p>
<p>Now there are numerous ways to achieving this, 2 of them being:</p>
<ol>
<li>Mult... | 2 | 2009-12-01T15:45:59Z | [
"python",
"networking",
"web-crawler",
"load-balancing",
"feedburner"
] |
Outgoing load balancer | 1,827,018 | <p>I have a big threaded feed retrieval script in python.</p>
<p>My question is, how can I load balance <em>outgoing</em> requests so that I don't hit any one host too often?</p>
<p>This is a big problem for feedburner, since a large percentage of sites proxy their RSS through feedburner and to further complicate mat... | 1 | 2009-12-01T15:43:14Z | 1,827,061 | <p><strong>"how can I load balance outgoing requests so that I don't hit any one host too often?"</strong></p>
<p>Generally, you do this by designing a better algorithm.</p>
<p>For example, randomly scramble your requests.</p>
<p>Or shuffle them 'fairly' so so that you round-robin through the sources. That would be... | 1 | 2009-12-01T15:50:32Z | [
"python",
"networking",
"web-crawler",
"load-balancing",
"feedburner"
] |
Outgoing load balancer | 1,827,018 | <p>I have a big threaded feed retrieval script in python.</p>
<p>My question is, how can I load balance <em>outgoing</em> requests so that I don't hit any one host too often?</p>
<p>This is a big problem for feedburner, since a large percentage of sites proxy their RSS through feedburner and to further complicate mat... | 1 | 2009-12-01T15:43:14Z | 1,827,072 | <p>You should probably do a one-time request (per week/month, whatever fits). for each feed and follow redirects to get the "true" address. Regardless of your throttling situation at the time, you should be able to resolve all feeds, save that data and then just do it once for every new feed you add to the list. You ca... | 3 | 2009-12-01T15:52:37Z | [
"python",
"networking",
"web-crawler",
"load-balancing",
"feedburner"
] |
Numpy meshgrid in 3D | 1,827,489 | <p>Numpy's meshgrid is very useful for converting two vectors to a coordinate grid. What is the easiest way to extend this to three dimensions? So given three vectors x, y, and z, construct 3x3D arrays (instead of 2x2D arrays) which can be used as coordinates.</p>
| 26 | 2009-12-01T16:53:37Z | 1,827,766 | <p>i think what you want is</p>
<pre><code>X, Y, Z = numpy.mgrid[-10:10:100j, -10:10:100j, -10:10:100j]
</code></pre>
<p>for example.</p>
| 5 | 2009-12-01T17:43:24Z | [
"python",
"numpy"
] |
Numpy meshgrid in 3D | 1,827,489 | <p>Numpy's meshgrid is very useful for converting two vectors to a coordinate grid. What is the easiest way to extend this to three dimensions? So given three vectors x, y, and z, construct 3x3D arrays (instead of 2x2D arrays) which can be used as coordinates.</p>
| 26 | 2009-12-01T16:53:37Z | 1,828,405 | <p>Can you show us how you are using np.meshgrid? There is a very good chance that you really don't need meshgrid because numpy broadcasting can do the same thing without generating a repetitive array.</p>
<p>For example,</p>
<pre><code>import numpy as np
x=np.arange(2)
y=np.arange(3)
[X,Y] = np.meshgrid(x,y)
S=X+Y
... | 6 | 2009-12-01T19:45:21Z | [
"python",
"numpy"
] |
Numpy meshgrid in 3D | 1,827,489 | <p>Numpy's meshgrid is very useful for converting two vectors to a coordinate grid. What is the easiest way to extend this to three dimensions? So given three vectors x, y, and z, construct 3x3D arrays (instead of 2x2D arrays) which can be used as coordinates.</p>
| 26 | 2009-12-01T16:53:37Z | 1,830,192 | <p>Here is the source code of meshgrid:</p>
<pre><code>def meshgrid(x,y):
"""
Return coordinate matrices from two coordinate vectors.
Parameters
----------
x, y : ndarray
Two 1-D arrays representing the x and y coordinates of a grid.
Returns
-------
X, Y : ndarray
For ... | 23 | 2009-12-02T01:53:21Z | [
"python",
"numpy"
] |
Numpy meshgrid in 3D | 1,827,489 | <p>Numpy's meshgrid is very useful for converting two vectors to a coordinate grid. What is the easiest way to extend this to three dimensions? So given three vectors x, y, and z, construct 3x3D arrays (instead of 2x2D arrays) which can be used as coordinates.</p>
| 26 | 2009-12-01T16:53:37Z | 9,548,255 | <p>Instead of writing a new function, <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ix_.html" rel="nofollow">numpy.ix_</a> should do what you want.</p>
| 3 | 2012-03-03T17:38:37Z | [
"python",
"numpy"
] |
Numpy meshgrid in 3D | 1,827,489 | <p>Numpy's meshgrid is very useful for converting two vectors to a coordinate grid. What is the easiest way to extend this to three dimensions? So given three vectors x, y, and z, construct 3x3D arrays (instead of 2x2D arrays) which can be used as coordinates.</p>
| 26 | 2009-12-01T16:53:37Z | 16,409,517 | <p>Here is a multidimensional version of meshgrid that I wrote:</p>
<pre><code>def ndmesh(*args):
args = map(np.asarray,args)
return np.broadcast_arrays(*[x[(slice(None),)+(None,)*i] for i, x in enumerate(args)])
</code></pre>
<p>Note that the returned arrays are views of the original array data, so changing th... | 4 | 2013-05-07T00:51:05Z | [
"python",
"numpy"
] |
Numpy meshgrid in 3D | 1,827,489 | <p>Numpy's meshgrid is very useful for converting two vectors to a coordinate grid. What is the easiest way to extend this to three dimensions? So given three vectors x, y, and z, construct 3x3D arrays (instead of 2x2D arrays) which can be used as coordinates.</p>
| 26 | 2009-12-01T16:53:37Z | 22,684,348 | <p>In case someone comes past this, numpy (as of 1.8 I think) support higher that 2D generation of position grids with <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.meshgrid.html">meshgrid</a>. One important addition which really helped me is the ability to chose the indexing order (either <code>xy... | 20 | 2014-03-27T10:11:38Z | [
"python",
"numpy"
] |
Django creating a form field that's read only using widgets | 1,827,526 | <p>My form field looks something like the following:</p>
<pre><code>class FooForm(ModelForm):
somefield = models.CharField(
widget=forms.TextInput(attrs={'readonly':'readonly'})
)
class Meta:
model = Foo
</code></pre>
<p>Geting an error like the following with the code above: <strong>init</stro... | 12 | 2009-12-01T16:58:46Z | 1,827,587 | <p>You should use a form field and not a model field:</p>
<pre><code>somefield = models.CharField(
widget=forms.TextInput(attrs={'readonly':'readonly'})
)
</code></pre>
<p>replaced with</p>
<pre><code>somefield = forms.CharField(
widget=forms.TextInput(attrs={'readonly':'readonly'})
)
</code></pre>
<p>Shoul... | 36 | 2009-12-01T17:09:18Z | [
"python",
"django",
"forms",
"widget"
] |
Django creating a form field that's read only using widgets | 1,827,526 | <p>My form field looks something like the following:</p>
<pre><code>class FooForm(ModelForm):
somefield = models.CharField(
widget=forms.TextInput(attrs={'readonly':'readonly'})
)
class Meta:
model = Foo
</code></pre>
<p>Geting an error like the following with the code above: <strong>init</stro... | 12 | 2009-12-01T16:58:46Z | 2,359,167 | <p>Note that the <code>readonly</code> attribute does not keep Django from processing any value sent by the client. If it is important to you that the value doesn't change, no matter how creative your users are with <a href="http://getfirebug.com/">FireBug</a>, you need to use a more involved method, e.g. a <code>ReadO... | 16 | 2010-03-01T21:23:17Z | [
"python",
"django",
"forms",
"widget"
] |
Django creating a form field that's read only using widgets | 1,827,526 | <p>My form field looks something like the following:</p>
<pre><code>class FooForm(ModelForm):
somefield = models.CharField(
widget=forms.TextInput(attrs={'readonly':'readonly'})
)
class Meta:
model = Foo
</code></pre>
<p>Geting an error like the following with the code above: <strong>init</stro... | 12 | 2009-12-01T16:58:46Z | 20,245,847 | <p>As Benjamin (<a href="http://stackoverflow.com/a/2359167/565525">http://stackoverflow.com/a/2359167/565525</a>) nicely explained, additionally to rendering correctly, you need to process field on backend properly. </p>
<p>There is an SO <a href="http://stackoverflow.com/questions/324477/in-a-django-form-how-to-make... | 1 | 2013-11-27T15:02:29Z | [
"python",
"django",
"forms",
"widget"
] |
Django creating a form field that's read only using widgets | 1,827,526 | <p>My form field looks something like the following:</p>
<pre><code>class FooForm(ModelForm):
somefield = models.CharField(
widget=forms.TextInput(attrs={'readonly':'readonly'})
)
class Meta:
model = Foo
</code></pre>
<p>Geting an error like the following with the code above: <strong>init</stro... | 12 | 2009-12-01T16:58:46Z | 21,654,715 | <p>I was going into the same problem so I created a Mixin that seems to work for my use cases.</p>
<pre><code>class ReadOnlyFieldsMixin(object):
readonly_fields =()
def __init__(self, *args, **kwargs):
super(ReadOnlyFieldsMixin, self).__init__(*args, **kwargs)
for field in (field for name, fie... | 3 | 2014-02-09T03:03:00Z | [
"python",
"django",
"forms",
"widget"
] |
how to find list of modules which depend upon a specific module in python | 1,827,629 | <p>In order to reduce development time of my Python based web application, I am trying to use reload() for the modules I have recently modified. The reload() happens through a dedicated web page (part of the development version of the web app) which lists the modules which have been recently modified (and the modified ... | 10 | 2009-12-01T17:18:35Z | 1,827,714 | <p>You might want to take a look at Ian Bicking's Paste reloader module, which does what you want already:</p>
<p><a href="http://pythonpaste.org/modules/reloader?highlight=reloader" rel="nofollow">http://pythonpaste.org/modules/reloader?highlight=reloader</a></p>
<p>It doesn't give you specifically a list of depende... | 3 | 2009-12-01T17:33:02Z | [
"python"
] |
how to find list of modules which depend upon a specific module in python | 1,827,629 | <p>In order to reduce development time of my Python based web application, I am trying to use reload() for the modules I have recently modified. The reload() happens through a dedicated web page (part of the development version of the web app) which lists the modules which have been recently modified (and the modified ... | 10 | 2009-12-01T17:18:35Z | 1,828,014 | <p>Some introspection to the rescue:</p>
<pre><code>from types import ModuleType
def find_modules(module, all_mods = None):
if all_mods is None:
all_mods = set([module])
for item_name in dir(module):
item = getattr(module, item_name)
if isinstance(item, ModuleType) and not item in all_mods:
... | 2 | 2009-12-01T18:34:41Z | [
"python"
] |
how to find list of modules which depend upon a specific module in python | 1,827,629 | <p>In order to reduce development time of my Python based web application, I am trying to use reload() for the modules I have recently modified. The reload() happens through a dedicated web page (part of the development version of the web app) which lists the modules which have been recently modified (and the modified ... | 10 | 2009-12-01T17:18:35Z | 1,847,094 | <p>So - this answers "Find a list of modules which depend on a given one" - instead of how the question was initally phrased - which I answered above.</p>
<p>As it turns out, this is a bit more complex: One have to find the dependency tree for all loaded modules, and invert it for each module, while preserving a loadi... | 5 | 2009-12-04T13:56:05Z | [
"python"
] |
In python how can I check to see if an object has a value? | 1,827,683 | <p>Base Account</p>
<pre><code>class BaseAccount(models.Model):
user = models.ForeignKey(User, unique=True)
def __unicode__(self):
"""
Return the unicode representation of this customer, which is the user's
full name, if set, otherwise, the user's username
"""
fn = self.user.get_full_name()
if... | 1 | 2009-12-01T17:27:40Z | 1,827,736 | <p>If the <code>Account</code> class is your user profile, as its docstring suggests, then you should be able to do something like this:</p>
<pre><code>is_trade_user = user.get_profile().default_address.trade_user
</code></pre>
<p>if the definition of a trade user is "Has a default address for which <code>trade_user<... | 5 | 2009-12-01T17:36:27Z | [
"python",
"django",
"django-models",
"django-views"
] |
Django using a generic view for create_update update_object, form not displaying | 1,827,817 | <p>Trying to use a generic view so I can update an object via a user facing form. My code looks like this in views:</p>
<pre><code>from django.views.generic.create_update import update_object
@permission_required('myapp.change_foo', login_url="/accounts/login/")
def foo_update(request, foo_id):
return update_obje... | 0 | 2009-12-01T17:56:53Z | 1,827,970 | <p>It's right there in the <a href="https://docs.djangoproject.com/en/1.4/ref/generic-views/#django-views-generic-create-update-update-object" rel="nofollow">documentation</a>:</p>
<blockquote>
<p>In addition to extra_context, the template's context will be:</p>
<ul>
<li><code>form</code>: A <code>django.form... | 0 | 2009-12-01T18:27:23Z | [
"django",
"python"
] |
reading mails using python | 1,827,848 | <p>how do i read mails from my mail box using python??</p>
<pre><code>import getpass, imaplib
M = imaplib.IMAP4('IMAP4.gmail.com:993')
M.login(getpass.getuser(), getpass.getpass())
M.select()
typ, data = M.search(None, 'ALL')
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print 'Message %s\n%... | 4 | 2009-12-01T18:03:46Z | 1,827,910 | <p>The error means that the host is unreachable or does not exist, which you could find out by googling for 'gaierror' (it stands for get address info error).</p>
<p>Try "imap.gmail.com:993" instead, as described <a href="http://mail.google.com/support/bin/answer.py?answer=78799" rel="nofollow">here</a>.</p>
| 1 | 2009-12-01T18:19:12Z | [
"python",
"email",
"gmail",
"imap"
] |
reading mails using python | 1,827,848 | <p>how do i read mails from my mail box using python??</p>
<pre><code>import getpass, imaplib
M = imaplib.IMAP4('IMAP4.gmail.com:993')
M.login(getpass.getuser(), getpass.getpass())
M.select()
typ, data = M.search(None, 'ALL')
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print 'Message %s\n%... | 4 | 2009-12-01T18:03:46Z | 1,828,673 | <p>Three issues:</p>
<ol>
<li>The hostname is <code>imap.gmail.com</code>, not <code>imap4.gmail.com</code></li>
<li>The IMAP4 constructor takes two parameters: the host and port (not colon-separated)</li>
<li>Gmail expects you to be talking SSL</li>
</ol>
<p>So:</p>
<pre><code>import imaplib
M = imaplib.IMAP4_SSL("... | 13 | 2009-12-01T20:26:46Z | [
"python",
"email",
"gmail",
"imap"
] |
Python syntax highlighting / Intellisense? | 1,828,040 | <p>I've started messing around with Google App Engine, writing Python.</p>
<p>I love Visual Studio for many reasons, but currently my .py files just look like text.</p>
<p>I've searched the web looking for a way to get it to highlight python files (intellisense would be a nice bonus, but not required) but turned up n... | 0 | 2009-12-01T18:38:46Z | 1,828,095 | <p>Unfortunately, I don't think there is any way to integrate VS with python.</p>
<p>If you want something not too heavyweight, you can use <a href="http://www.activestate.com/komodo%5Fedit/" rel="nofollow">Komodo edit</a>, - it is quite good for small-to-medium projects. You can use pydev+aptana studio or pydev+eclip... | 0 | 2009-12-01T18:49:14Z | [
"python",
"visual-studio",
"google-app-engine"
] |
Python syntax highlighting / Intellisense? | 1,828,040 | <p>I've started messing around with Google App Engine, writing Python.</p>
<p>I love Visual Studio for many reasons, but currently my .py files just look like text.</p>
<p>I've searched the web looking for a way to get it to highlight python files (intellisense would be a nice bonus, but not required) but turned up n... | 0 | 2009-12-01T18:38:46Z | 1,828,112 | <p>Under Windows you could use <a href="http://notepad-plus.sourceforge.net" rel="nofollow">Notepad ++</a>. It has syntax highlight for the python and is rather functionally rich, lightweight editor.</p>
| 0 | 2009-12-01T18:52:00Z | [
"python",
"visual-studio",
"google-app-engine"
] |
Python syntax highlighting / Intellisense? | 1,828,040 | <p>I've started messing around with Google App Engine, writing Python.</p>
<p>I love Visual Studio for many reasons, but currently my .py files just look like text.</p>
<p>I've searched the web looking for a way to get it to highlight python files (intellisense would be a nice bonus, but not required) but turned up n... | 0 | 2009-12-01T18:38:46Z | 1,828,477 | <p>Thanks for all the responses. I did scan through some Python IDEs (and their screenshots) and decided to check out IronPythonStudio. My .py files now get colour coded nicely, and there's some intellisense :) Unfortunately Ctrl+K,D doesn't work, but it's much nicer to code than the plain yellow text I had earlier.</p... | 1 | 2009-12-01T19:56:31Z | [
"python",
"visual-studio",
"google-app-engine"
] |
Python syntax highlighting / Intellisense? | 1,828,040 | <p>I've started messing around with Google App Engine, writing Python.</p>
<p>I love Visual Studio for many reasons, but currently my .py files just look like text.</p>
<p>I've searched the web looking for a way to get it to highlight python files (intellisense would be a nice bonus, but not required) but turned up n... | 0 | 2009-12-01T18:38:46Z | 11,250,604 | <p><a href="http://pytools.codeplex.com/" rel="nofollow">http://pytools.codeplex.com/</a> </p>
<p>This is a replacement for IronPythonStudio and works well with VS2010. As for python, you can point it at any python directory library (including Ironpython, etc) for intellisense. Best part is, it's free.</p>
| 1 | 2012-06-28T18:16:43Z | [
"python",
"visual-studio",
"google-app-engine"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.