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 |
|---|---|---|---|---|---|---|---|---|---|
Is Python2.6 stable enough for production use? | 828,862 | <p>Or should I just stick with Python2.5 for a bit longer?</p>
| 7 | 2009-05-06T09:44:28Z | 830,235 | <p>I recently switched from python2.5 to 2.6 for my research project involving lots of 3rd party libs (scipy, pydot, etc.) and swig related stuff. </p>
<p>The only thing I had to change was to convert all strings with</p>
<blockquote>
<p>s = unicode(s, "utf-8")</p>
</blockquote>
<p>before I fed them into the loggi... | 1 | 2009-05-06T15:39:18Z | [
"python"
] |
Using Python multiprocessing while importing a module via file path | 829,123 | <p>I'm writing a program which imports a module using a file path, with the function <code>imp.load_source(module_name,module_path)</code>. It seems to cause a problem when I try to pass objects from this module into a <code>Process</code>.</p>
<p>An example:</p>
<pre><code>import multiprocessing
import imp
class My... | 2 | 2009-05-06T11:18:41Z | 829,229 | <p><code>test.py</code> on any folder:</p>
<pre><code>import multiprocessing
import imp
class MyProcess(multiprocessing.Process):
def __init__(self,thing):
multiprocessing.Process.__init__(self)
self.thing=thing
def run(self):
print 'running...', self.thing()
if __name__=="__main__":... | -1 | 2009-05-06T11:59:20Z | [
"python",
"import",
"module",
"multiprocessing"
] |
Using Python multiprocessing while importing a module via file path | 829,123 | <p>I'm writing a program which imports a module using a file path, with the function <code>imp.load_source(module_name,module_path)</code>. It seems to cause a problem when I try to pass objects from this module into a <code>Process</code>.</p>
<p>An example:</p>
<pre><code>import multiprocessing
import imp
class My... | 2 | 2009-05-06T11:18:41Z | 829,406 | <p>I've just done the following, running on XP with Python 2.5...</p>
<p><code>D:\Experiments\ModuleLoading\test.py</code></p>
<pre><code>import imp
if __name__=="__main__":
module=imp.load_source('life', r'D:\Experiments\ModuleLoading\somefolder\life.py')
thing=module.step
print(thing)
</code></pre>
<p... | -1 | 2009-05-06T12:50:49Z | [
"python",
"import",
"module",
"multiprocessing"
] |
Using Python multiprocessing while importing a module via file path | 829,123 | <p>I'm writing a program which imports a module using a file path, with the function <code>imp.load_source(module_name,module_path)</code>. It seems to cause a problem when I try to pass objects from this module into a <code>Process</code>.</p>
<p>An example:</p>
<pre><code>import multiprocessing
import imp
class My... | 2 | 2009-05-06T11:18:41Z | 830,669 | <p>Probably it does not work because of placing of import code into main block.
Code below works on Windows XP, Python 2.6. Then life module will also be imported in new process.</p>
<pre><code>import multiprocessing
import imp
class MyProcess(multiprocessing.Process):
def __init__(self,thing):
multiprocessing.... | 1 | 2009-05-06T17:03:28Z | [
"python",
"import",
"module",
"multiprocessing"
] |
Django: custom constructor for form class, trouble with accessing data from request.POST | 829,156 | <p>I have written custom constructor for a form, the whole form class looks like this:</p>
<pre><code>class UploadForm(forms.Form):
file = forms.FileField(label = "Plik")
def __init__(self, coto, naglowek, *args, **kwargs):
super(UploadForm, self).__init__(*args, **kwargs)
self.coto = coto
... | -1 | 2009-05-06T11:29:49Z | 829,177 | <pre><code>request.POST['coto']
request.POST['naglowek']
</code></pre>
<p>I guess.</p>
| 0 | 2009-05-06T11:39:15Z | [
"python",
"django",
"post",
"webforms"
] |
Django: custom constructor for form class, trouble with accessing data from request.POST | 829,156 | <p>I have written custom constructor for a form, the whole form class looks like this:</p>
<pre><code>class UploadForm(forms.Form):
file = forms.FileField(label = "Plik")
def __init__(self, coto, naglowek, *args, **kwargs):
super(UploadForm, self).__init__(*args, **kwargs)
self.coto = coto
... | -1 | 2009-05-06T11:29:49Z | 829,315 | <p>You've redefined default form constructor and change its parameters order. So you have to instantiate your custom form with explicit naming of arguments:</p>
<pre><code>form = UploadForm(data=request.POST, files=request.FILES, coto=..., naglowek=...)
</code></pre>
| 0 | 2009-05-06T12:27:28Z | [
"python",
"django",
"post",
"webforms"
] |
Django: custom constructor for form class, trouble with accessing data from request.POST | 829,156 | <p>I have written custom constructor for a form, the whole form class looks like this:</p>
<pre><code>class UploadForm(forms.Form):
file = forms.FileField(label = "Plik")
def __init__(self, coto, naglowek, *args, **kwargs):
super(UploadForm, self).__init__(*args, **kwargs)
self.coto = coto
... | -1 | 2009-05-06T11:29:49Z | 829,752 | <p>Your question is a mess. There's code and there's an edit with another question. The edit question has nothing to do with the title.</p>
<p>Please update this question to be your <em>real</em> question. </p>
<p>If you have multiple submit buttons, you must give them distinct names or values (or both). Here's o... | 2 | 2009-05-06T14:04:49Z | [
"python",
"django",
"post",
"webforms"
] |
What is the proper procedure for offering a patch to the Python documentation? | 829,341 | <p>I'm about to dive into the source code for the cgi.py module again because the MiniFieldStorage class is mentioned in the documentation, but not actually documented. It occurred to me that I have done this so many times that maybe I could write documentation for it. If I did, how should I submit it?</p>
| 4 | 2009-05-06T12:32:06Z | 829,356 | <p>There's a page regarding <a href="http://python.org/dev/doc/" rel="nofollow">Documentation Development</a> on the official web site which looks like a good starting point. It appears as though you simply add to the issue tracker and attach a patch in the normal way.</p>
<p>In particular, it points to <em><a href="h... | 4 | 2009-05-06T12:38:02Z | [
"python",
"documentation"
] |
What is the proper procedure for offering a patch to the Python documentation? | 829,341 | <p>I'm about to dive into the source code for the cgi.py module again because the MiniFieldStorage class is mentioned in the documentation, but not actually documented. It occurred to me that I have done this so many times that maybe I could write documentation for it. If I did, how should I submit it?</p>
| 4 | 2009-05-06T12:32:06Z | 829,372 | <p>I would suggest posting an issue to the <a href="http://bugs.python.org/issue?%40search%5Ftext=&title=&%40columns=title&id=&%40columns=id&stage=&creation=&creator=&activity=&%40columns=activity&%40sort=activity&actor=&nosy=&type=&components=4&versions=&... | 1 | 2009-05-06T12:41:44Z | [
"python",
"documentation"
] |
str.format() -> how to left-justify | 829,667 | <pre><code>>>> print 'there are {0:10} students and {1:10} teachers'.format(scnt, tcnt)
there are 100 students and 20 teachers
</code></pre>
<p>What would be the code so that the output became:</p>
<pre><code>there are 100 students and 20 teachers
</code></pre>
<p>Thanks.</p>
| 7 | 2009-05-06T13:49:46Z | 829,687 | <pre><code>print 'there are {0:<10} students and {1:<10} teachers'.format(scnt, tcnt)
</code></pre>
<p>While the old <code>%</code> operator uses <code>-</code> for alignment, the new <code>format</code> method uses <code><</code> and <code>></code></p>
| 15 | 2009-05-06T13:53:29Z | [
"python"
] |
Mosso Python Module | 829,916 | <p>Has anybody had success installing the Mosso (cloudfiles) python module? I'm trying to install it and getting the following error.</p>
<pre><code>python-cloudfiles-1.3.1]# python setup.py install
running install
running build
running build_py
running install_lib
byte-compiling /usr/lib/python2.3/site-packages/clou... | 1 | 2009-05-06T14:35:07Z | 829,964 | <p>It looks like you're running a version of Python prior to 2.4 - the syntax it's complaining about (the @ symbol, known as a "decorator") was introduced in Python 2.4.</p>
| 5 | 2009-05-06T14:45:39Z | [
"python",
"module",
"mosso",
"cloudfiles"
] |
Python's PIL crop problem: color of cropped image screwed | 830,366 | <p>I have a probably very basic problem with PIL's crop function: The cropped image's colors are totally screwed. Here's the code:</p>
<pre><code>>>> from PIL import Image
>>> img = Image.open('football.jpg')
>>> img
<PIL.JpegImagePlugin.JpegImageFile instance at 0x00
>>> img.for... | 4 | 2009-05-06T16:07:18Z | 830,449 | <p><code>output</code> should be a file name, not a handler.</p>
| 4 | 2009-05-06T16:21:57Z | [
"python",
"image-processing",
"colors",
"python-imaging-library",
"crop"
] |
Python's PIL crop problem: color of cropped image screwed | 830,366 | <p>I have a probably very basic problem with PIL's crop function: The cropped image's colors are totally screwed. Here's the code:</p>
<pre><code>>>> from PIL import Image
>>> img = Image.open('football.jpg')
>>> img
<PIL.JpegImagePlugin.JpegImageFile instance at 0x00
>>> img.for... | 4 | 2009-05-06T16:07:18Z | 833,916 | <p>instead of</p>
<pre><code>output = open('cropped_football.jpg', 'w')
area.save(output)
output.close()
</code></pre>
<p>just do</p>
<pre><code>area.save('cropped_football.jpg')
</code></pre>
| 3 | 2009-05-07T10:35:36Z | [
"python",
"image-processing",
"colors",
"python-imaging-library",
"crop"
] |
Python's PIL crop problem: color of cropped image screwed | 830,366 | <p>I have a probably very basic problem with PIL's crop function: The cropped image's colors are totally screwed. Here's the code:</p>
<pre><code>>>> from PIL import Image
>>> img = Image.open('football.jpg')
>>> img
<PIL.JpegImagePlugin.JpegImageFile instance at 0x00
>>> img.for... | 4 | 2009-05-06T16:07:18Z | 6,833,306 | <p>Since the call to <code>save</code> actually produced output, I have to assume that PIL is able to use either a filename or an open file interchangeably. The problem is in the file mode, which by default will try to convert based on text conventions - a '\n' will be replaced by '\r\n' on Windows. You need to open th... | 1 | 2011-07-26T16:23:20Z | [
"python",
"image-processing",
"colors",
"python-imaging-library",
"crop"
] |
design for handling exceptions - google app engine | 830,597 | <p>I'm developing a project on google app engine (webapp framework). I need you people to assess how I handle exceptions.</p>
<p>There are 4 types of exceptions I am handling:</p>
<ol>
<li>Programming exceptions</li>
<li>Bad user input</li>
<li>Incorrect URLs</li>
<li>Incorrect query strings</li>
</ol>
<p>Here is ho... | 6 | 2009-05-06T16:51:40Z | 830,672 | <p>You seem to have thought things through pretty well. The only thing I would add is that you might want to take a look at <a href="http://github.com/DocSavage/bloog/tree/master" rel="nofollow">Bloog</a> as an example. Bloog is a pretty well written and popular open source blog engine for App Engine written in Python.... | 5 | 2009-05-06T17:03:47Z | [
"python",
"google-app-engine",
"exception-handling",
"web-applications"
] |
design for handling exceptions - google app engine | 830,597 | <p>I'm developing a project on google app engine (webapp framework). I need you people to assess how I handle exceptions.</p>
<p>There are 4 types of exceptions I am handling:</p>
<ol>
<li>Programming exceptions</li>
<li>Bad user input</li>
<li>Incorrect URLs</li>
<li>Incorrect query strings</li>
</ol>
<p>Here is ho... | 6 | 2009-05-06T16:51:40Z | 833,840 | <p>Ad. #4: I usually treat query strings as non-essential. If anything is wrong with query string, I'd just present bare resource page (as if no query was present), possibly with some information to user what was wrong with the query string.</p>
<p>This leads to the problem similar to your #3: how did the user got int... | 0 | 2009-05-07T10:14:34Z | [
"python",
"google-app-engine",
"exception-handling",
"web-applications"
] |
Python Iterator Help + lxml | 830,600 | <p>I have this script-</p>
<pre><code>import lxml
from lxml.cssselect import CSSSelector
from lxml.etree import fromstring
from lxml.html import parse
website = parse('http://example.com').getroot()
selector = website.cssselect('.name')
for i in range(0,18):
print selector[i].text_content()
</code></pre>
... | 1 | 2009-05-06T16:52:23Z | 830,621 | <p>What about</p>
<pre><code>for e in selector:
print e.text_content()
</code></pre>
<p>?</p>
| 2 | 2009-05-06T16:56:07Z | [
"python",
"iterator",
"for-loop",
"lxml"
] |
Python Iterator Help + lxml | 830,600 | <p>I have this script-</p>
<pre><code>import lxml
from lxml.cssselect import CSSSelector
from lxml.etree import fromstring
from lxml.html import parse
website = parse('http://example.com').getroot()
selector = website.cssselect('.name')
for i in range(0,18):
print selector[i].text_content()
</code></pre>
... | 1 | 2009-05-06T16:52:23Z | 830,626 | <p>The CSSSelector.cssselect() method returns an iterable, so you can just do:</p>
<pre><code>for element in selector:
print element.text_content()
</code></pre>
| 5 | 2009-05-06T16:56:47Z | [
"python",
"iterator",
"for-loop",
"lxml"
] |
Python Iterator Help + lxml | 830,600 | <p>I have this script-</p>
<pre><code>import lxml
from lxml.cssselect import CSSSelector
from lxml.etree import fromstring
from lxml.html import parse
website = parse('http://example.com').getroot()
selector = website.cssselect('.name')
for i in range(0,18):
print selector[i].text_content()
</code></pre>
... | 1 | 2009-05-06T16:52:23Z | 830,634 | <p>I would expect you want a for loop like:</p>
<pre><code>selectors = website.cssselect('.name , .name, .desc')
for selector in selectors:
print selector.text_content()
</code></pre>
| 2 | 2009-05-06T16:57:48Z | [
"python",
"iterator",
"for-loop",
"lxml"
] |
Python convert args to kwargs | 830,937 | <p>I am writing a decorator that needs to call other functions prior to call of the function that it is decorating. The decorated function may have positional arguments, but the functions the decorator will call can only accept keyword arguments. Does anyone have a handy way of converting positional arguments into ke... | 8 | 2009-05-06T18:14:35Z | 831,164 | <p>Any arg that was passed positionally will be passed to *args. And any arg passed as a keyword will be passed to **kwargs.
If you have positional args values and names then you can do:</p>
<pre><code>kwargs.update(dict(zip(myfunc.func_code.co_varnames, args)))
</code></pre>
<p>to convert them all into keyword args.... | 12 | 2009-05-06T19:00:32Z | [
"python",
"decorator"
] |
Python convert args to kwargs | 830,937 | <p>I am writing a decorator that needs to call other functions prior to call of the function that it is decorating. The decorated function may have positional arguments, but the functions the decorator will call can only accept keyword arguments. Does anyone have a handy way of converting positional arguments into ke... | 8 | 2009-05-06T18:14:35Z | 833,327 | <p>Note - co_varnames will include local variables as well as keywords. This probably won't matter, as zip truncates the shorter sequence, but may result in confusing error messages if you pass the wrong number of args.</p>
<p>You can avoid this with <code>func_code.co_varnames[:func_code.co_argcount]</code>, but bet... | 2 | 2009-05-07T07:37:01Z | [
"python",
"decorator"
] |
Python convert args to kwargs | 830,937 | <p>I am writing a decorator that needs to call other functions prior to call of the function that it is decorating. The decorated function may have positional arguments, but the functions the decorator will call can only accept keyword arguments. Does anyone have a handy way of converting positional arguments into ke... | 8 | 2009-05-06T18:14:35Z | 2,313,392 | <p>Well, this may be overkill. I wrote it for the dectools package (on PyPi), so you can get updates there. It returns the dictionary taking into account positional, keyword, and default arguments. There is a test suite in the package (test_dict_as_called.py):</p>
<pre><code> def _dict_as_called(function, args, kwa... | 4 | 2010-02-22T19:08:23Z | [
"python",
"decorator"
] |
Python convert args to kwargs | 830,937 | <p>I am writing a decorator that needs to call other functions prior to call of the function that it is decorating. The decorated function may have positional arguments, but the functions the decorator will call can only accept keyword arguments. Does anyone have a handy way of converting positional arguments into ke... | 8 | 2009-05-06T18:14:35Z | 19,535,485 | <p>If you're using Python >= 2.7 <code>inspect.getcallargs</code> does this for you out of the box. You'd just pass it the decorated function as the first argument, and then the rest of the arguments exactly as you plan to call it. Example:</p>
<pre><code>>>> def f(p1, p2, k1=None, k2=None, **kwargs):
... ... | 2 | 2013-10-23T07:31:18Z | [
"python",
"decorator"
] |
Using Beautiful Soup, how do I iterate over all embedded text? | 830,997 | <p>Let's say I wanted to remove vowels from HTML:</p>
<pre><code><a href="foo">Hello there!</a>Hi!
</code></pre>
<p>becomes</p>
<pre><code><a href="foo">Hll thr!</a>H!
</code></pre>
<p>I figure this is a job for Beautiful Soup. How can I select the text in between tags and operate on it like... | 4 | 2009-05-06T18:26:52Z | 831,544 | <p>Suppose the variable <code>test_html</code> has the following html content:</p>
<pre><code><html>
<head><title>Test title</title></head>
<body>
<p>Some paragraph</p>
Useless Text
<a href="http://stackoverflow.com">Some link</a>not a link
<a href="http:/... | 7 | 2009-05-06T20:18:58Z | [
"python",
"beautifulsoup"
] |
How to make a persistent com server in Python | 831,217 | <p>I'd like to create a COM server that can hold it state across the calls. My goal is to have a thread-safe in-memory database. And provide an access to it via COM interface.</p>
<p>Is that possible?</p>
| 0 | 2009-05-06T19:11:41Z | 854,850 | <p><a href="http://www.devshed.com/c/a/Python/Windows-Programming-in-Python-Creating-COM-Servers/" rel="nofollow">http://www.devshed.com/c/a/Python/Windows-Programming-in-Python-Creating-COM-Servers/</a></p>
| 0 | 2009-05-12T20:59:03Z | [
"python",
"com"
] |
How to make a persistent com server in Python | 831,217 | <p>I'd like to create a COM server that can hold it state across the calls. My goal is to have a thread-safe in-memory database. And provide an access to it via COM interface.</p>
<p>Is that possible?</p>
| 0 | 2009-05-06T19:11:41Z | 7,378,250 | <p>Given the lack of popularity of COM I've ended up providing XMLRPC interface at least I know how to diagnose errors if they occur.</p>
| 0 | 2011-09-11T12:42:26Z | [
"python",
"com"
] |
A production ready server to serve django on win32 | 831,288 | <p>I'd like to serve django application on windows XP/Vista.
The application is an at hoc web interface to a windows program so it won't be put under heavy load (around 100 requests per second).</p>
<p>Do you know any small servers that can be easily deployed on windows to serve a django app? (IIS is not an option as ... | 3 | 2009-05-06T19:25:46Z | 831,322 | <p>Why not Apache ? </p>
<p>Nokia have developed a scaled down version of apache to run on their mobile phones. It supports python. </p>
<p><a href="http://research.nokia.com/research/projects/mobile-web-server/" rel="nofollow">http://research.nokia.com/research/projects/mobile-web-server/</a></p>
<p>Also do you nee... | 0 | 2009-05-06T19:34:05Z | [
"python",
"windows",
"django"
] |
A production ready server to serve django on win32 | 831,288 | <p>I'd like to serve django application on windows XP/Vista.
The application is an at hoc web interface to a windows program so it won't be put under heavy load (around 100 requests per second).</p>
<p>Do you know any small servers that can be easily deployed on windows to serve a django app? (IIS is not an option as ... | 3 | 2009-05-06T19:25:46Z | 831,449 | <p><a href="http://cherrypy.org">cherrypy</a> includes a good server. <a href="http://lincolnloop.com/blog/2008/mar/25/serving-django-cherrypy/">Here</a>'s how you set it up to work with django and some benchmarks.</p>
<p><a href="http://twistedmatrix.com/trac/wiki/TwistedWeb">twisted.web</a> has <a href="http://wsgi.... | 5 | 2009-05-06T19:57:34Z | [
"python",
"windows",
"django"
] |
A production ready server to serve django on win32 | 831,288 | <p>I'd like to serve django application on windows XP/Vista.
The application is an at hoc web interface to a windows program so it won't be put under heavy load (around 100 requests per second).</p>
<p>Do you know any small servers that can be easily deployed on windows to serve a django app? (IIS is not an option as ... | 3 | 2009-05-06T19:25:46Z | 831,639 | <p>If you want to give Apache a go, check out <a href="http://www.apachefriends.org/en/xampp.html" rel="nofollow">XAMPP</a> to see if it'll work for you. You can do a lightweight (read: no installation) "installation." Of course, you'll also want to install <a href="http://www.modpython.org/" rel="nofollow">mod_python<... | 1 | 2009-05-06T20:41:30Z | [
"python",
"windows",
"django"
] |
How do you create an anonymous Python telnet connection? | 831,679 | <p>I am trying to telnet into a server using Python on Windows XP. I can connect successfully by typing 'telnet HOST PORT' which creates an anonymous connection. But Python's telnetlib.Telnet(HOST, PORT) returns 'Connection refused'. Telnetting in Java also fails. Spelunking shows that Python tries to create an ano... | 1 | 2009-05-06T20:51:39Z | 831,743 | <p>It would be a good idea to trace both connection attempts (a failing case and a successful case) with <a href="http://www.wireshark.org/" rel="nofollow">wireshark</a> or similar packet trace tool to see what the difference is at the protocol level.</p>
| 1 | 2009-05-06T21:03:46Z | [
"java",
"python",
"windows",
"telnet"
] |
How do you create an anonymous Python telnet connection? | 831,679 | <p>I am trying to telnet into a server using Python on Windows XP. I can connect successfully by typing 'telnet HOST PORT' which creates an anonymous connection. But Python's telnetlib.Telnet(HOST, PORT) returns 'Connection refused'. Telnetting in Java also fails. Spelunking shows that Python tries to create an ano... | 1 | 2009-05-06T20:51:39Z | 831,845 | <p>First, eliminate telnetlib as your problem: <pre><code>import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("remote.host", 23))</code></pre> If that succeeds, there is a problem in your usage of <code>telnetlib</code>, and we'll need to see an example. If it fails, then you have a basic net... | 1 | 2009-05-06T21:25:01Z | [
"java",
"python",
"windows",
"telnet"
] |
Python imaging, resize Turtle Graphics window | 831,894 | <p>My image is too large for the turtle window. I had to enlarge the image because the text I need at each spot overlaps. </p>
<p>How do I Resize the window in python?</p>
| 1 | 2009-05-06T21:34:58Z | 831,944 | <p>It sounds like you have drawn an image, but it has gone outside the borders of the window, so therefore you need to make the window larger to see the entire image. </p>
<p>To resize the window:</p>
<blockquote>
<p>setup( width = 200, height = 200, startx = None, starty = None) </p>
</blockquote>
<p>This will ma... | 2 | 2009-05-06T21:48:15Z | [
"python",
"turtle-graphics"
] |
Scaffold or django-admin without Auth app | 831,934 | <p>I created my own Auth app, and now Admin is not working, what can you suggest?</p>
<p>Exception now is: 'User' object has no attribute 'is_authenticated'</p>
<p>I know my User really have no such method. So I have 2 ways:
- change admin
- adapt my user system</p>
<p>My question was: is there possibility to e... | -2 | 2009-05-06T21:45:29Z | 833,865 | <p>See the file django/contrib/admin/views/decorators.py:</p>
<pre><code>from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
</code></pre>
<p>These are used in decorator <code>staff_member_required</code> which guards access to admin application.</p>
<p>Admin application r... | 3 | 2009-05-07T10:21:29Z | [
"python",
"django",
"django-admin",
"scaffolding"
] |
Python: Finding all packages inside a package | 832,004 | <p>Given a package, how can I automatically find all its sub-packages?</p>
| 6 | 2009-05-06T22:00:39Z | 832,040 | <p>You can't rely on introspection of loaded modules, because sub-packages may not have been loaded. You'll have to look at the filesystem, assuming the top level package in question is not an egg, zip file, extension module, or loaded from memory.</p>
<pre><code>def get_subpackages(module):
dir = os.path.dirname... | 9 | 2009-05-06T22:11:51Z | [
"python",
"import",
"packages"
] |
Python: Finding all packages inside a package | 832,004 | <p>Given a package, how can I automatically find all its sub-packages?</p>
| 6 | 2009-05-06T22:00:39Z | 832,125 | <p>Inspired by James Emerton's answer:</p>
<pre><code>def find_subpackages(module):
result=[]
for thing in os.listdir(os.path.dirname(module.__file__)):
full=os.path.join(os.path.dirname(module.__file__),thing)
if os.path.isdir(full):
if glob.glob(os.path.join(full, '__init__.py*'))... | 0 | 2009-05-06T22:32:25Z | [
"python",
"import",
"packages"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,023 | <p>I use TextMate for Rails, PHP and Python development and I love it.</p>
<p>After seeing other answers I feel like I should elaborate. I use MySQL currently as my primary database and Apache for a web server. When coding in PHP I prefer to use CodeIgniter rather than "vanilla" php.</p>
<p>However, most importantly ... | 2 | 2009-05-06T22:06:16Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,028 | <ul>
<li>svn or a modern dvcs (git, mercurial or bazaar)</li>
<li>Generally not an IDE. Instead, TextMate on Mac, Notepad++ on Windows, or the one true editor (emacs or vim) on Linux.</li>
<li>MySQL and SQL in general is worth understanding as a separate item.</li>
</ul>
| 10 | 2009-05-06T22:08:24Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,087 | <p>I mostly work with PHP. I regularly use: </p>
<p>Coding Environment: <strong>Netbeans, vim</strong></p>
<p>Framework: <strong>Zend Framework (sometimes Code Igniter)</strong></p>
<p>Troubleshooting and Profiling: <strong>xdebug, webgrind (or kcachegrind)</strong></p>
<p>Database: <strong>MySQL</strong> </p>
<p>... | 1 | 2009-05-06T22:21:49Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,107 | <p>Zend Framework
MySQL
Eclipse as an IDE (or Aptana Studio specifically)</p>
| 1 | 2009-05-06T22:26:59Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,210 | <ul>
<li>XDebug for debugging</li>
<li>phpUnderControl for agile tools</li>
</ul>
| 1 | 2009-05-06T23:01:06Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,215 | <p>emacs with the menubar disabled FTW, keeps the mind sharp, and once your muscle memory is tuned, your productivity should skyrocket.....maybe</p>
<p>eclipse + aptana can be a good thing too, i just wish I could figure out how to make it let me just edit a damn file without declaring a workspace and project etc...</... | 1 | 2009-05-06T23:02:32Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,273 | <p>I use Eclipse PDT (IDE) and Notepad++ (editor) for development. They fill each other out imo.</p>
<p>Kdiff3 for comparing files.</p>
<p>Subversion for version control at work. But git/mercury could be better, especially for a school situation.</p>
<p>On windows I use WinGrep to search for files with some content ... | 1 | 2009-05-06T23:23:09Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,302 | <p>I like aptana so far</p>
| 1 | 2009-05-06T23:37:09Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,361 | <p>Source Control: Git (and I love github.com)</p>
<p>Editors: TextMate (Mac) , E-TextEditor (Windows, and soon on Linux)</p>
<p>IDEs: I hate IDEs, specially those Eclipse based ones like Aptana, but if your're an IDE guy or your project/company requires one NetBeans is the best.</p>
<p>Frameworks: Using Rails most ... | 1 | 2009-05-07T00:04:54Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,422 | <p>I'd add <a href="http://pylonshq.com/" rel="nofollow">pylons</a> to the Frameworks section under python. and <a href="http://www.sqlite.org/" rel="nofollow">sqlite</a> to the database section - if mainly for development purposes.</p>
<p>oh yeah, and <a href="http://ngrep.sourceforge.net/" rel="nofollow">ngrep</a> ... | 1 | 2009-05-07T00:35:25Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,459 | <p>For web designers don't forget Photoshop, Dreamweaver and Flash.</p>
| 0 | 2009-05-07T00:54:39Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,460 | <p><strong>FTP Client!</strong> You will save your class hours of frustration if you can find them a good (free) FTP program. There are many free FTP clients, but they usually suffer from some of these problems:</p>
<ul>
<li>Poor interface design makes it tedious to upload/download multiple specific files to/from nest... | 1 | 2009-05-07T00:54:58Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,463 | <p>When push comes to shove (or even pull) then I use <a href="http://www.wireshark.org/" rel="nofollow">Wireshark</a>, because sometimes you really <strong>really</strong> need to know what's going on!</p>
| 0 | 2009-05-07T00:57:26Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 832,586 | <p>I use Aptana/RadRails for my Ruby on Rails IDE. It's good.</p>
<p>Recently I've been using its debugger more, and it's saved me a fair amount of time.</p>
| 1 | 2009-05-07T02:03:36Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 833,077 | <p><strong>Database</strong> MySQL, CouchDB, SQLite</p>
<p><strong>Source Control</strong> Git</p>
<p><strong>Editor</strong> <a href="http://caladbolg.net/textadept" rel="nofollow">TextAdept</a>, E, vim</p>
<p><strong>Frameworks</strong> CakePHP, Ramaze</p>
<p><strong>Debugging</strong> Error messages? :(</p>
| 1 | 2009-05-07T05:57:39Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 834,513 | <p>Ruby on Rails actually has an implicit default stack. This is mostly defined by what the contributing community use, and some components have shifted over time, but there is surprisingly little divergence on some items compared to other communities, which is probably both a good and a bad thing. It's definitely help... | 3 | 2009-05-07T12:59:38Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 883,916 | <p>Well, "Industry Standard" is somewhat difficult to nail down. It all depends on the person. However, I think in general, there are a number of things that you should commit yourself to. </p>
<ol>
<li>PHP, SQL Database of some sort, HTML, XML, CSS</li>
<li>A lightweight approach to editing. For example, Textmate, or... | 1 | 2009-05-19T16:57:07Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 883,942 | <p>Netbeans with the jVi plugin. My biggest productivity boost I've ever had.</p>
| 1 | 2009-05-19T17:02:30Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 883,989 | <p>The most important tool for Ruby work is RubyGems. Ideally users should be able to install gems themselves. RubyGems can be configured to install gems in the user's home directory instead of system wide, which could work well on multi-user machines.</p>
<p>Of course a good text editor, revision control, and Firebug... | 1 | 2009-05-19T17:11:18Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 884,042 | <p>When working in Flash/Flex, i've found <a href="http://demonsterdebugger.com/" rel="nofollow">De Monster Debugger</a> to be extremely handy. Allows you to view your swf files in real time, and you can trace any object, and even call methods of objects.</p>
| 1 | 2009-05-19T17:21:17Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 1,629,310 | <p>Working on large, complex PHP applications can be overwhelming. We have a new Eclipse plugin for that: <a href="http://www.nwiresoftware.com/products/nwire-php" rel="nofollow">nWire for PHP</a>.</p>
<p>nWire for PHP is an innovative Eclipse plugin (works with Eclipse PDT & Zend Studio 7) which accelerates PHP d... | 1 | 2009-10-27T07:54:09Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 2,028,445 | <p>I'm going to guess that it is web development that your father wants to teach. One thing that slows down the learning of web development is also having to learn how to configure infrastructure (e.g. web server, database, application server, etc) and deploy applications. These activities take a surprising amount of t... | 0 | 2010-01-08T15:11:26Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 2,030,271 | <ul>
<li>Ruby on Rails</li>
<li>MacVim</li>
<li>Git</li>
<li>Chrome has Webkit web development inspector for web debugging</li>
<li>MySQL/SQLite (you might want to look into MongoDB)</li>
</ul>
| 1 | 2010-01-08T19:50:42Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 2,030,972 | <p>Cart before the horse. Introduce tools if only absolutely necessary. The goal should be to teach programming and protocols. Throwing in tools is sure to confuse and overwhelm students. </p>
<p>Based on the question, I'm not sure your father has the experience to design a web development program. We are talking abou... | 1 | 2010-01-08T21:44:45Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 18,573,446 | <p>No doubt PHP is one of the most popular languages amongst developers and aids them in creating innovative and dynamic web applications. PHP developers keep looking for useful and handy php tools which they can use to make their workflow and web related tasks easier, faster, and better. There are scads of php tools a... | 1 | 2013-09-02T12:34:54Z | [
"php",
"python",
"ruby"
] |
What tools do web developers use with PHP, Ruby on Rails, Python, etc? | 832,017 | <p>A good friend just sent me the following email</p>
<blockquote>
<p>My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, heâs proposing they teach web design and web development. My question is in your opinion what are the âindustry stand... | 9 | 2009-05-06T22:04:34Z | 26,889,612 | <p>For python PyCharm and for javascript I use Webstorm</p>
| 0 | 2014-11-12T14:41:30Z | [
"php",
"python",
"ruby"
] |
How to set up Python in a web server? | 832,140 | <p>Not exactly about programming, but I need help with this.</p>
<p>I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.</p>
<p>However, ... | 4 | 2009-05-06T22:36:24Z | 832,159 | <p>Django is not a web server, but a web application framework.</p>
<p>If you want a bare-bones Python webserver capable of some dynamic and some static content, have a look at <a href="http://www.cherrypy.org/">CherryPy</a>.</p>
| 5 | 2009-05-06T22:41:23Z | [
"python",
"windows",
"django"
] |
How to set up Python in a web server? | 832,140 | <p>Not exactly about programming, but I need help with this.</p>
<p>I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.</p>
<p>However, ... | 4 | 2009-05-06T22:36:24Z | 832,163 | <p>To use python with your Apache server you need to install mod_python the following links should help you out a bit.</p>
<ul>
<li><a href="http://httpd.apache.org/modules/python-download.cgi" rel="nofollow">http://httpd.apache.org/modules/python-download.cgi</a></li>
<li><a href="http://www.modpython.org/" rel="nofo... | 0 | 2009-05-06T22:42:36Z | [
"python",
"windows",
"django"
] |
How to set up Python in a web server? | 832,140 | <p>Not exactly about programming, but I need help with this.</p>
<p>I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.</p>
<p>However, ... | 4 | 2009-05-06T22:36:24Z | 832,176 | <p>If it's truly a development server you're setting up, and not a machine that will be promoted to production at some point, Django has a <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/#the-development-server" rel="nofollow">built-in development webserver</a> that requires no Apache configuration. </p>... | 0 | 2009-05-06T22:47:24Z | [
"python",
"windows",
"django"
] |
How to set up Python in a web server? | 832,140 | <p>Not exactly about programming, but I need help with this.</p>
<p>I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.</p>
<p>However, ... | 4 | 2009-05-06T22:36:24Z | 832,409 | <p>Use <a href="http://code.google.com/p/modwsgi/" rel="nofollow">mod_wsgi</a> to embed Python in Apache. It works very, very well.</p>
<p>"However, from what I gathered (I may be wrong) you have to do more low-level stuff with WSGI than with PHP. So I researched about Django, but it seems too complex for what I want... | 3 | 2009-05-07T00:30:18Z | [
"python",
"windows",
"django"
] |
How to set up Python in a web server? | 832,140 | <p>Not exactly about programming, but I need help with this.</p>
<p>I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.</p>
<p>However, ... | 4 | 2009-05-06T22:36:24Z | 832,741 | <p><a href="http://werkzeug.pocoo.org/" rel="nofollow">Werkzeug</a> is a great little python tool (werkzeug) that works with mod_wsgi for creating simple apps that dont need database backends with CMS's, such as calculators .. They've even got a nifty <a href="http://werkzeug.pocoo.org/wiki30/" rel="nofollow">screenca... | 2 | 2009-05-07T03:14:24Z | [
"python",
"windows",
"django"
] |
Launch a webpage on a Firefox (win) tab using Python | 832,331 | <p>I'm trying to launch a website url in a new tab using python in that way, but it didn't worked in these both ways:</p>
<p>Method 1:</p>
<pre><code>os.system('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');
</code></pre>
<p>and Method 2:</p>
<pre><code>os.startfile('C:\Program File... | 13 | 2009-05-06T23:52:20Z | 832,338 | <p>You need to use the <a href="http://docs.python.org/library/webbrowser.html" rel="nofollow"><code>webbrowser</code></a> module</p>
<pre><code>import webbrowser
webbrowser.open('http://www.google.com')
</code></pre>
<p>[<strong>edit</strong>]</p>
<p>If you want to open a url in a non-default browser try:</p>
<pre... | 38 | 2009-05-06T23:55:52Z | [
"python",
"windows",
"command-line"
] |
Launch a webpage on a Firefox (win) tab using Python | 832,331 | <p>I'm trying to launch a website url in a new tab using python in that way, but it didn't worked in these both ways:</p>
<p>Method 1:</p>
<pre><code>os.system('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');
</code></pre>
<p>and Method 2:</p>
<pre><code>os.startfile('C:\Program File... | 13 | 2009-05-06T23:52:20Z | 832,348 | <p>Use <code>os.startfile()</code> passing only the url. This will cause the URL to be opened in a new tab/window in the user's default browser, which is much nicer to your user.</p>
| 3 | 2009-05-06T23:58:48Z | [
"python",
"windows",
"command-line"
] |
Launch a webpage on a Firefox (win) tab using Python | 832,331 | <p>I'm trying to launch a website url in a new tab using python in that way, but it didn't worked in these both ways:</p>
<p>Method 1:</p>
<pre><code>os.system('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');
</code></pre>
<p>and Method 2:</p>
<pre><code>os.startfile('C:\Program File... | 13 | 2009-05-06T23:52:20Z | 832,356 | <p>If you want to start a program with parameters the <a href="http://docs.python.org/library/subprocess.html" rel="nofollow">subprocess</a> module is a better fit:</p>
<pre><code>import subprocess
subprocess.call([r'C:\Program Files\Mozilla Firefox\Firefox.exe',
'-new-tab', 'http://www.google.com/'])
</code></pre... | 4 | 2009-05-07T00:02:09Z | [
"python",
"windows",
"command-line"
] |
Launch a webpage on a Firefox (win) tab using Python | 832,331 | <p>I'm trying to launch a website url in a new tab using python in that way, but it didn't worked in these both ways:</p>
<p>Method 1:</p>
<pre><code>os.system('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');
</code></pre>
<p>and Method 2:</p>
<pre><code>os.startfile('C:\Program File... | 13 | 2009-05-06T23:52:20Z | 832,373 | <p>You might want to try:</p>
<pre><code>import os
os.spawnl(os.P_NOWAIT, r'C:\Program Files\Mozilla Firefox\Firefox.exe',
r'FireFox', '-new-tab', 'http://www.google.com/')
</code></pre>
| 0 | 2009-05-07T00:09:37Z | [
"python",
"windows",
"command-line"
] |
Duplicate text detection / hashing | 832,485 | <p>I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.</p>... | 1 | 2009-05-07T01:12:10Z | 832,488 | <p>If there are only 500 strings in the database, perhaps you can directly compare to each one. First convert to a standard representation (say UTF-16). The <a href="http://en.wikipedia.org/wiki/Levenshtein_distance" rel="nofollow">Levenshtein distance</a> can be a nice way of comparing the similarity of two strings.... | 1 | 2009-05-07T01:16:09Z | [
"python"
] |
Duplicate text detection / hashing | 832,485 | <p>I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.</p>... | 1 | 2009-05-07T01:12:10Z | 832,559 | <p>For starters, you should probably do some sort of normalization. You should probably convert all of your text to a single encoding (eg: UTF-8). You may also want to do case-folding, other <a href="http://unicode.org/reports/tr15/" rel="nofollow">Unicode normalizations</a> and perhaps also sorting each set (depending... | 3 | 2009-05-07T01:45:35Z | [
"python"
] |
Duplicate text detection / hashing | 832,485 | <p>I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.</p>... | 1 | 2009-05-07T01:12:10Z | 832,590 | <p>The short answer is just guess at what a good hash parameter would be that matches your ideas of "similar". </p>
<p>Probably just something like sum of all the letters (A) and the sum of the differences between adjacent letters (B), might work. For each new string, use its A and B values to quickly lookup a now mu... | 1 | 2009-05-07T02:05:37Z | [
"python"
] |
Duplicate text detection / hashing | 832,485 | <p>I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.</p>... | 1 | 2009-05-07T01:12:10Z | 832,840 | <p>This might be overkill, but you might want to try <a href="http://www.nltk.org/Home" rel="nofollow">NLTK (Natural Language Toolkit)</a>, which is Python based.</p>
<p>One feature that might be useful is to <a href="http://nltk.googlecode.com/svn/trunk/doc/book/ch08.html" rel="nofollow">analyze sentence structure</a... | 0 | 2009-05-07T03:58:55Z | [
"python"
] |
Duplicate text detection / hashing | 832,485 | <p>I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.</p>... | 1 | 2009-05-07T01:12:10Z | 833,585 | <p>you could get crazy and try latent semantic analysis/mapping and the singular value decomposition:
<a href="http://www.ling.upenn.edu/courses/cogs501/BellegardaIEEE.pdf" rel="nofollow">latent semantic mapping</a></p>
<p>together with <a href="http://tedlab.mit.edu/~dr/svdlibc/" rel="nofollow">SVDLIBC</a>, which is ... | 0 | 2009-05-07T09:00:37Z | [
"python"
] |
Duplicate text detection / hashing | 832,485 | <p>I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.</p>... | 1 | 2009-05-07T01:12:10Z | 10,756,877 | <p><a href="http://prosehack.wordpress.com/2012/05/25/a-simple-near-duplicate-detection-algorithm/" rel="nofollow">This post</a> on my blog may be of interest.</p>
<p>A description of the algorithm and link to the code is provided. In short, it's an n-grams based approach that makes no assumption about the content or... | 1 | 2012-05-25T15:07:17Z | [
"python"
] |
What is the best way to programmatically log into a web site in order to screen scrape? (Preferably in Python) | 832,673 | <p>I want to be able to log into a website programmatically and periodically obtain some information from the site. What is the best tool(s) that would make this as simple as possible? I'd prefer a Python library of some type because I want to become more proficient in Python, but I'm open to any suggestions.</p>
| 2 | 2009-05-07T02:45:59Z | 832,697 | <p>You can try Mechanize (<a href="http://wwwsearch.sourceforge.net/mechanize/" rel="nofollow">http://wwwsearch.sourceforge.net/mechanize/</a>) for programmatic web-browsing, and definitely use Beautiful Soup (<a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">http://www.crummy.com/software/Beautifu... | 8 | 2009-05-07T02:58:54Z | [
"python",
"screen-scraping"
] |
What is the best way to programmatically log into a web site in order to screen scrape? (Preferably in Python) | 832,673 | <p>I want to be able to log into a website programmatically and periodically obtain some information from the site. What is the best tool(s) that would make this as simple as possible? I'd prefer a Python library of some type because I want to become more proficient in Python, but I'm open to any suggestions.</p>
| 2 | 2009-05-07T02:45:59Z | 833,506 | <p>i recommend using <a href="http://twill.idyll.org/" rel="nofollow">twill</a> it makes it a snap to do the login procedure. then use beautifulsoup etc.
as described above. ive never tried mechanize, but it looks pretty good.</p>
| 1 | 2009-05-07T08:42:12Z | [
"python",
"screen-scraping"
] |
What is the best way to programmatically log into a web site in order to screen scrape? (Preferably in Python) | 832,673 | <p>I want to be able to log into a website programmatically and periodically obtain some information from the site. What is the best tool(s) that would make this as simple as possible? I'd prefer a Python library of some type because I want to become more proficient in Python, but I'm open to any suggestions.</p>
| 2 | 2009-05-07T02:45:59Z | 833,559 | <p>I once wrote a Python script to automatically log into vBulletin forums. The difficult part was knowing how to correctly form the login request and that is something that a library won't help you with. I found <a href="http://livehttpheaders.mozdev.org/" rel="nofollow">Live Http Headers</a> - an addon for Firefox - ... | 2 | 2009-05-07T08:52:47Z | [
"python",
"screen-scraping"
] |
What is the best way to programmatically log into a web site in order to screen scrape? (Preferably in Python) | 832,673 | <p>I want to be able to log into a website programmatically and periodically obtain some information from the site. What is the best tool(s) that would make this as simple as possible? I'd prefer a Python library of some type because I want to become more proficient in Python, but I'm open to any suggestions.</p>
| 2 | 2009-05-07T02:45:59Z | 834,297 | <p>Most of us use <a href="http://docs.python.org/library/urllib2.html" rel="nofollow">urllib2</a> to get the page; it can handle various forms of authentication and cookie collection. Then <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">Beautiful Soup</a> to parse the results.</p>
| 3 | 2009-05-07T12:13:11Z | [
"python",
"screen-scraping"
] |
What is the best way to programmatically log into a web site in order to screen scrape? (Preferably in Python) | 832,673 | <p>I want to be able to log into a website programmatically and periodically obtain some information from the site. What is the best tool(s) that would make this as simple as possible? I'd prefer a Python library of some type because I want to become more proficient in Python, but I'm open to any suggestions.</p>
| 2 | 2009-05-07T02:45:59Z | 25,520,459 | <p>just for screen scraping you can use combination of url lib + pyqyery.
<a href="https://pythonhosted.org/pyquery/" rel="nofollow">https://pythonhosted.org/pyquery/</a></p>
| 0 | 2014-08-27T06:40:23Z | [
"python",
"screen-scraping"
] |
PDF Tables of Arbitrary (within reason) Width | 832,693 | <p>I know PDF generation has been discussed a lot here; however, I've yet to find what I need.</p>
<p>I'm trying to generate PDF reports (mainly tables) from python. Yes I've tried ReportLab and Pisa. Both had column content "break out" in circumstances I didn't think were unreasonable and unrealistic to encounter i... | 2 | 2009-05-07T02:57:38Z | 832,904 | <p>Using TeX might give you good results. I would be tempted to avoid LaTeX, myself, but that's because it's a really complicated macro package and I've never really understood it when I've tried to use it; plus, at least given my tastes back then, it seemed a very verbose way to mark up my text compared with what I wa... | 2 | 2009-05-07T04:36:25Z | [
"python",
"pdf",
"xhtml",
"latex"
] |
PDF Tables of Arbitrary (within reason) Width | 832,693 | <p>I know PDF generation has been discussed a lot here; however, I've yet to find what I need.</p>
<p>I'm trying to generate PDF reports (mainly tables) from python. Yes I've tried ReportLab and Pisa. Both had column content "break out" in circumstances I didn't think were unreasonable and unrealistic to encounter i... | 2 | 2009-05-07T02:57:38Z | 837,011 | <p>The stand alone program : wkhtmltopdf is exactly what I needed. The PDF rendering of XHTML is the best of seen from a free tool.</p>
| 1 | 2009-05-07T20:59:00Z | [
"python",
"pdf",
"xhtml",
"latex"
] |
PDF Tables of Arbitrary (within reason) Width | 832,693 | <p>I know PDF generation has been discussed a lot here; however, I've yet to find what I need.</p>
<p>I'm trying to generate PDF reports (mainly tables) from python. Yes I've tried ReportLab and Pisa. Both had column content "break out" in circumstances I didn't think were unreasonable and unrealistic to encounter i... | 2 | 2009-05-07T02:57:38Z | 837,111 | <p>I completely agree with Brandon Craig Rhodes answer.
TeX, plain or with a macro package like LaTeX or ConTeXt, would be a good solution if
you need high quality output. However TeX is a heavy dependency</p>
<p>If you are looking for a lighter alternative you can try to</p>
<ul>
<li><p>generate xsl-fo and render i... | 3 | 2009-05-07T21:23:37Z | [
"python",
"pdf",
"xhtml",
"latex"
] |
Cannot access Python server running as Windows service | 833,062 | <p>I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create a Windows service.</p>
<p>I installed it on a computer running Windows XP Pro SP3. However, I can't connect to it when it's running as a service. I can confirm that it's binding to the address/port, because I get a confl... | 1 | 2009-05-07T05:52:05Z | 833,105 | <p>Possibly the program may be terminated just after initialization. Please check whether it is continuously listening to the requests.</p>
<pre><code>netstat -an |find /i "listening"
</code></pre>
<p>And analyze the command line parsed to the programs. You may use <a href="http://technet.microsoft.com/en-us/sysinter... | 1 | 2009-05-07T06:12:15Z | [
"python",
"windows-services",
"tcp"
] |
Cannot access Python server running as Windows service | 833,062 | <p>I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create a Windows service.</p>
<p>I installed it on a computer running Windows XP Pro SP3. However, I can't connect to it when it's running as a service. I can confirm that it's binding to the address/port, because I get a confl... | 1 | 2009-05-07T05:52:05Z | 834,878 | <p>Check to see that the service is running under the Nertwork Service account and not the Local System account. The later doesn't have network access and is the default user to run services under. You can check this by going to the services app under administrative tool in the start menu and looking for your service... | 0 | 2009-05-07T14:12:28Z | [
"python",
"windows-services",
"tcp"
] |
Cannot access Python server running as Windows service | 833,062 | <p>I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create a Windows service.</p>
<p>I installed it on a computer running Windows XP Pro SP3. However, I can't connect to it when it's running as a service. I can confirm that it's binding to the address/port, because I get a confl... | 1 | 2009-05-07T05:52:05Z | 904,114 | <p>First of all, whenever you implement a Windows service, be sure to add proper logging.</p>
<p>My worker threads were terminating because of the exception, "The socket operation could not complete without blocking."</p>
<p>The solution was to simply call <code>sock.setblocking(1)</code> after accepting the connecti... | 1 | 2009-05-24T16:29:36Z | [
"python",
"windows-services",
"tcp"
] |
Python style iterators in C | 833,063 | <p>The "yield" statement in python allows simple iteration from a procedure, and it also means that sequences don't need to be pre-calculated AND stored in a array of "arbitrary" size.</p>
<p>Is there a there a similar way of iterating (with yield) from a C procedure?</p>
| 6 | 2009-05-07T05:52:46Z | 833,071 | <p>I pull this URL out as a joke from time to time: <a href="http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html" rel="nofollow">Coroutines in C</a>.</p>
<p>I think the correct answer to your question is this: there's no direct equivalent, and attempts to fake it probably won't be nearly as clean or easy to us... | 3 | 2009-05-07T05:55:25Z | [
"python",
"c",
"iterator",
"jit",
"algol68"
] |
Python style iterators in C | 833,063 | <p>The "yield" statement in python allows simple iteration from a procedure, and it also means that sequences don't need to be pre-calculated AND stored in a array of "arbitrary" size.</p>
<p>Is there a there a similar way of iterating (with yield) from a C procedure?</p>
| 6 | 2009-05-07T05:52:46Z | 833,074 | <p>No.</p>
<p>Nice and short!</p>
| 0 | 2009-05-07T05:55:55Z | [
"python",
"c",
"iterator",
"jit",
"algol68"
] |
Python style iterators in C | 833,063 | <p>The "yield" statement in python allows simple iteration from a procedure, and it also means that sequences don't need to be pre-calculated AND stored in a array of "arbitrary" size.</p>
<p>Is there a there a similar way of iterating (with yield) from a C procedure?</p>
| 6 | 2009-05-07T05:52:46Z | 838,867 | <p><em>Here follows a community-wiki copy of the self-answer, which can be chosen as "the" answer. Please direct up/downvotes to the actual self-answer</em></p>
<p>Here is the method I found:</p>
<pre><code> /* Example calculates the sum of the prime factors of the first 32 Fibonacci numbers */
#include <stdio.... | 6 | 2009-05-08T08:48:36Z | [
"python",
"c",
"iterator",
"jit",
"algol68"
] |
How to run a script without being in the tasktray? | 833,356 | <p>I have a scheduled task which runs a python script every 10 min</p>
<p>so it turns out that a script pops up on my desktop every 10 min</p>
<p>how can i make it invincible so my script will work in the background ?</p>
<p>I've been told that pythonw will do the work, but I cant figure out how to use it</p>
<p>an... | 1 | 2009-05-07T07:45:26Z | 833,364 | <p>Set the scheduled task to start the script as minimized.</p>
| 0 | 2009-05-07T07:50:13Z | [
"python"
] |
How to run a script without being in the tasktray? | 833,356 | <p>I have a scheduled task which runs a python script every 10 min</p>
<p>so it turns out that a script pops up on my desktop every 10 min</p>
<p>how can i make it invincible so my script will work in the background ?</p>
<p>I've been told that pythonw will do the work, but I cant figure out how to use it</p>
<p>an... | 1 | 2009-05-07T07:45:26Z | 833,391 | <blockquote>
<p>I've been told that pythonw will do the work, but I cant figure out how to use it</p>
</blockquote>
<p>Normally you just have to rename the file extension to .pyw. Then it will be executed by pythonw.</p>
| 3 | 2009-05-07T07:58:06Z | [
"python"
] |
Need help for developing facebook app | 833,406 | <p>I am trying to develop facebook app using django.</p>
<p>The problem I am facing is how to use facebook api and get user friend list.</p>
<p>view.py</p>
<pre><code>def canvas(request):
# Get the User object
user, created = FacebookUser.objects.get_or_create(id = request.facebook.uid)
return direct_to... | 1 | 2009-05-07T08:01:49Z | 833,454 | <p>Try using single quotes when loading up the userID etc. </p>
<p>Failing that it would appear to be either of the following
- Output error from python. The HTML / FBML output should be as follows</p>
<ul>
<li><p>Double check the attributes you are adding are correct. Case sensitive. </p></li>
<li><p>Are you loadin... | 0 | 2009-05-07T08:20:35Z | [
"python",
"django",
"facebook"
] |
What i need to install python 2.5 on SCO 5.0.5 | 833,624 | <p>I would love to install python2.5 on sco unix, and am wondering anybody who has attempted to do this?</p>
| 1 | 2009-05-07T09:11:34Z | 833,631 | <p>Did you already try the <a href="http://www.python.org/download/source/" rel="nofollow">standard source instructions</a>, and fail? If so, I guess it would be useful to mention what failed. This is almost a non-programming question, as it's phrased now ...</p>
| 2 | 2009-05-07T09:14:52Z | [
"python",
"unix"
] |
I need a sample of python unit testing sqlalchemy model with nose | 833,626 | <p>Can someone show me how to write unit tests for sqlalchemy model I created using nose.</p>
<p>I just need one simple example.</p>
<p>Thanks.</p>
| 22 | 2009-05-07T09:12:34Z | 833,915 | <p>You can simply create an in-memory SQLite database and bind your session to that.</p>
<p>Example:</p>
<pre><code>
from db import session # probably a contextbound sessionmaker
from db import model
from sqlalchemy import create_engine
def setup():
engine = create_engine('sqlite:///:memory:')
session.confi... | 35 | 2009-05-07T10:35:31Z | [
"python",
"unit-testing",
"testing",
"sqlalchemy",
"nose"
] |
I need a sample of python unit testing sqlalchemy model with nose | 833,626 | <p>Can someone show me how to write unit tests for sqlalchemy model I created using nose.</p>
<p>I just need one simple example.</p>
<p>Thanks.</p>
| 22 | 2009-05-07T09:12:34Z | 920,631 | <p>Check out the <a href="http://code.google.com/p/fixture/" rel="nofollow">fixture</a> project. We used nose to test that and it's also a way to declaratively define data to test against, there will be some extensive examples for you to use there!</p>
<p>See also <a href="http://farmdev.com/projects/fixture/" rel="no... | 2 | 2009-05-28T12:40:17Z | [
"python",
"unit-testing",
"testing",
"sqlalchemy",
"nose"
] |
Returning http status codes in Python CGI | 833,715 | <p>Is it possible to send a status code other than 200 via a python cgi script (such as 301 redirect)</p>
| 15 | 2009-05-07T09:33:26Z | 833,728 | <p>via cgi script?</p>
<pre><code>print "Status:301\nLocation: http://www.google.com"
</code></pre>
| 20 | 2009-05-07T09:35:43Z | [
"python",
"http",
"cgi"
] |
Returning http status codes in Python CGI | 833,715 | <p>Is it possible to send a status code other than 200 via a python cgi script (such as 301 redirect)</p>
| 15 | 2009-05-07T09:33:26Z | 834,128 | <p>Via wsgi application?</p>
<pre><code>def simple_app(environ, start_response):
status = '301 Moved Permanently' # HTTP Status
headers = [('Location','http://example.com')] # HTTP Headers
start_response(status, headers)
return []
</code></pre>
| 0 | 2009-05-07T11:27:24Z | [
"python",
"http",
"cgi"
] |
Threading TCP Server as proxy between connected user and unix socket | 833,962 | <p>I'm writing web application where I need to push data from server to the connected clients. This data can be send from any other script from web application. For example one user make some changes on the server and other users should be notified about that. </p>
<p>So my idea is to use unix socket (path to socket b... | 0 | 2009-05-07T10:46:21Z | 834,277 | <p>This is too complex. Use the <a href="http://docs.python.org/library/socketserver.html#module-SocketServer" rel="nofollow">socketserver</a> module, please. </p>
| 0 | 2009-05-07T12:08:26Z | [
"python",
"multithreading",
"sockets",
"tcp"
] |
Threading TCP Server as proxy between connected user and unix socket | 833,962 | <p>I'm writing web application where I need to push data from server to the connected clients. This data can be send from any other script from web application. For example one user make some changes on the server and other users should be notified about that. </p>
<p>So my idea is to use unix socket (path to socket b... | 0 | 2009-05-07T10:46:21Z | 834,285 | <p>I think You should not use unix sockets. If Your app will (someday) become popular or mission-critical, You won't be able to just add another server to add scalability or to make it redundant and fail-safe.</p>
<p>If, on the other hand, You will put the data into f.e. memcached (and user's "dataset number" as the s... | 1 | 2009-05-07T12:10:38Z | [
"python",
"multithreading",
"sockets",
"tcp"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.