python

Django sub-url deployment on Ubuntu server

Hello, I need to set up a django development environment that is publicly viewable on the internet (I am doing this for school, and my projects need to be viewable by my professor, this isn't a setup that needs much security). I have a virtual server running Ubuntu 8.04 LTS. I need to have multiple django applications running in subdir...

What are some good projects to make for a newbie Python (but not new to programming) developer?

I'm downloading Python 3.1.1 and that comes with the IDLE correct? I'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. What projects should I try to make in order to grasp some of the goodies Python brings to the table? Thanks a bunch SO. ...

PyQt Qtreewidget turn off selection

By default a QTreeWidget manages the selection of rows [when you click a row it highlights it, when you click another row it highlights that and deselects the previous row] , I dont want this and cant figure out how to turn it off. ...

If I use QT For Windows, will my application run great on Linux/Mac/Windows?

I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct? Having said that, if I create my application in QT For Windows, will it run flawlessly in Linux/Mac as well? Thanks. ...

Python synchronised reading of sorted files

I have two groups of files that contain data in CSV format with a common key (Timestamp) - I need to walk through all the records chronologically. Group A: 'Environmental Data' Filenames are in format A_0001.csv, A_0002.csv, etc. Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains environmental data in CSV/column...

Getting a list of errors in a Django form

I'm trying to create a form in Django. That works and all, but I want all the errors to be at the top of the form, not next to each field that has the error. I tried looping over form.errors, but it only showed the name of the field that had an error, not an error message such as "Name is required." This is pretty much what I'd like to ...

[Python] Download a webpage and media

Hi! I need to download a webpage and all its media (like css javascript and images) to make a sort of backup (like firefox does when you click on File -> Save) with python. Is there any library to do that or I shall create my own one? ...

Python: Why does this doc test fail?

This code that's in the doctest works when run by itself, but in this doctest it fails in 10 places. I can't figure out why it does though. The following is the entire module: class requireparams(object): """ >>> @requireparams(['name', 'pass', 'code']) >>> def complex_function(params): >>> print(params['name']) ...

python: how to refer to the class from within it ( like the recursive function)

For a recursive function we can do: def f(i): if i<0: return print i f(i-1) f(10) However is there a way to do the following thing? class A: # do something some_func(A) # ... ...

I just installed QT for Windows but I can't find the control toolbox anywhere. Where do I drag controls to a form?

I opened a starter application to see how it works but I only see C++ files, nothing in Python. How can I configure QT to work for Python? :S Also, where can I find the visual form? ...

Python UDP socket options for multiple & concurrent clients

Hi all. Let me explain a bit the app i'm doing. I'm creating a central UDP (needs to be UDP) server for multiple and concurrent clients that also "talk" between them. I do a check into a dict of known clients addresses and create a client handler thread if "i dont know" the client. Else, the thread receives the data ad does its job. Th...

Coming from a Visual C# Express IDE/C# programming background, is there a tutorial for creating python applications?

It's very overwhelming coming from something that helps you create applications straight forward to something with somewhat convoluted documentation. Can someone please share a tutorial on how to create a simple Hello World application using Python. No, I don't mean command line. I mean a physical window. I'm trying to learn how to pro...

what is my current desktop environment

how can i get from python that, what is my desktop environment i mean I like the result be gnome or KDE or else ...

purpose of '"sss".decode("base64").decode("zlib")'.

ACTIVATE_THIS = """ eJx1UsGOnDAMvecrIlYriDRlKvU20h5aaY+teuilGo1QALO4CwlKAjP8fe1QGGalRoLEefbzs+Mk Sb7NcvRo3iTcoGqwgyy06As+HWSNVciKaBTFywYoJWc7yit2ndBVwEkHkIzKCV0YdQdmkvShs6YH E3IhfjFaaSNLoHxQy2sLJrL0ow98JQmEG/rAYn7OobVGogngBgf0P0hjgwgt7HOUaI5DdBVJkggR 3HwSktaqWcCtgiHIH7qHV+esW2CnkRJ+9R5cQGsikkWEV/J7leVGs9TV4TvcO5QOOrTHYI+xeCjY JR/m9GPDHv2...

how to modularize django settings.py?

When you install a new django application, you have to add/modify your settings.py module. For a project I'm trying to make that module a python subpackage and create a module for each application: settings\ __init__.py base.py admin.py feincms.py ... The problem I'm confronted with is how to merge settings.py att...

Why does this use of Smooth cause Python to crash?

Hi- I'm using Python 2.6 against OpenCV 2.0. I've started a file capture and pulled frames. I've displayed the image to make sure it's valid. When I call this routine, python crashes: def SmoothImage(self,SmoothingMaskSize=3): temp=cv.CreateImage(cv.GetSize(self._lpImage),self._lpImage.depth,self._lpImage.nChannels) cv.Smo...

Raise and lower QTreeWidgetItem in a QTreeWidget?

Question says it all how do you raise and lower [change the positions of ] QTreeWidgetItems in a QtreeWidget , ...

How to mock users and requests in django

I have django code that interacts with request objects or user objects. For instance something like: foo_model_instance = models.get_or_create_foo_from_user(request.user) If you were going to test with the django python shell or in a unittest, what would you pass in there? Here simply a User object will do, but the need for a mock req...

Tips on how to parse custom file format

Hello, Sorry about the vague title, but I really don't know how to describe this problem concisely. I've created a (more or less) simple domain-specific language that I will to use to specify what validation rules to apply to different entities (generally forms submitted from a web page). I've included a sample at the bottom of this po...

Python: Decorators: How does the following code work?

Are the comments in the following code correct? Particularly the "instance =..." one? # This does nothing. class donothing(object): def __init__(self, func): """ The 'func' argument is the function being decorated because in this case, we're not instantiating the decorator class. Instead we are just ...