python

Question about SimpleHTTPServer.py

I am partially through implementing the functionality of SimpleHTTPServer.py in Scheme. I am having some good fun with HTTP request/response mechanism. While going through the above file, I came across this- " # redirect browser - doing basically what apache does" in the code". Why is this redirection necessary in such a scenario? ...

Where are Man -pages for the module MySQLdb in Python?

I would like to get Python's documentation for MySQLdb in Man -format such that I can read them in terminal. Where are Man -pages for MySQLdb in Python? ...

models.py getting huge, what is the best way to break it up?

Directions from my supervisor: "I want to avoid putting any logic in the models.py. From here on out, let's use that as only classes for accessing the database, and keep all logic in external classes that use the models classes, or wrap them." I feel like this is the wrong way to go. I feel that keeping logic out of the models just to ...

How to use schemas in Django?

I whould like to use postgreSQL schemas with django, how can I do this? ...

Django - last insert id

I can't get the last insert id like I usually do and I'm not sure why. In my view: comment = Comments( ...) comment.save() comment.id #returns None In my Model: class Comments(models.Model): id = models.IntegerField(primary_key=True) Has anyone run into this problem before? Usually after I call the save() method, I have acces...

win32api.dll Will Not Install

I am trying to start a Buildbot Buildslave on a Windows XP virtual machine: python buildbot start . ImportError: No module named win32api. Google tells me that win32api is win32api.dll. I downloaded the file from www.dll-files.com and followed the guide found on that site (http://www.dll-files.com/unzip.php). When I try to run regv...

Can you point me to a large Python open-source project?

I would like to see how a large (>40 developers) project done with Python looks like: how the code looks like what folder structure they use what tools they use how they set up the collaboration environment what kind of documentation they provide It doesn't matter what type of software it is (server, client, application, web, ...) b...

how do I read everything currently in a subprocess.stdout pipe and then return?

I'm using python's subprocess module to interact with a program via the stdin and stdout pipes. If I call the subprocesses readline() on stdout, it hangs because it is waiting for a newline. How can I do a read of all the characters in the stdout pipe of a subprocess instance? If it matters, I'm running in Linux. ...

Add data to Django form class using modelformset_factory

I have a problem where I need to display a lot of forms for detail data for a hierarchical data set. I want to display some relational fields as labels for the forms and I'm struggling with a way to do this in a more robust way. Here is the code... class Category(models.Model): name = models.CharField(max_length=160) class Item(mod...

Python Notation?

I've just started using Python and I was thinking about which notation I should use. I've read the PEP 8 guide about notation for Python and I agree with most stuff there except function names (which I prefer in mixedCase style). In C++ I use a modified version of the Hungarian notation where I don't include information about type but o...

Google Wave Sandbox

Is anyone developing robots and/or gadgets for Google Wave? I have been a part of the sandbox development for a few days and I was interested in seeing what others have thought about the Google Wave APIs. I was also wondering what everyone has been working on. Please share your opinions and comments! ...

Why can't I import this Zope component in a Python 2.4 virtualenv?

I'm trying to install Plone 3.3rc4 with plone.app.blob and repoze but nothing I've tried has worked so far. For one attempt I've pip-installed repoze.zope2, Plone, and plone.app.blob into a virtualenv. I have this version of DocumentTemplate in the virtualenv's site-packages directory and I'm trying to get it running in RHEL5. For some ...

Online Python interpreter for use *from* the iPhone?

Is there an online Python interpreter or some such that would allow me to try out simple python code from my iPhone? Something like try ruby! (in your browser) for Python, and works with the iPhone? ...

python docstrings

ok so I decided to learn python (perl, c, c++, java, objective-c, ruby and a bit of erlang and scala under my belt). and I keep on getting the following error when I try executing this: Tue Jul 21{stevenhirsch@steven-hirschs-macbook-pro-2}/projects/python:-->./apache_logs.py File "./apache_logs.py", line 17 print __doc__ ...

Retrieving Raw_Input from a system ran script

I'm using the OS.System command to call a python script. example: OS.System("call jython script.py") In the script I'm calling, the following command is present: x = raw_input("Waiting for input") If I run script.py from the command line I can input data no problem, if I run it via the automated approach I get an EOFError. I've r...

limit output from a sort method

if my views code is: arttags = sorted(arttags, key=operator.attrgetter('date_added'), reverse=True) what is the argument that will limit the result to 50 tags? I'm assuming this: .... limit=50) is incorrect. more complete code follows: videoarttags = Media.objects.order_by('date_added'),filter(topic__exact='art') audioarttags =...

How can I get DNS records for a domain in python?

How do I get the DNS records for a zone in python? I'm looking for data similar to the output of dig. ...

What is the benefit of private name mangling in Python?

Python provides private name mangling for class methods and attributes. Are there any concrete cases where this feature is required, or is it just a carry over from Java and C++? Please describe a use case where Python name mangling should be used, if any? Also, I'm not interested in the case where the author is merely trying to preve...

Easiest way to pop up interactive Python console?

My application has a Python interpreter embedded in it. However there's currently not any way to inspect anything about Python directly. I'd like to be able to pop up an interactive shell at various points to inspect what's going on in Python. I've found several similar questions which pointed me to code.InteractiveConsole and IPython. ...

What's the right way to use Unicode metadata in setup.py?

I was writing a setup.py for a Python package using setuptools and wanted to include a non-ASCII character in the long_description field: #!/usr/bin/env python from setuptools import setup setup(... long_description=u"...", # in real code this value is read from a text file ...) Unfortunately, passing a unicode object to s...