Suppose there is a program with a couple of objects living in it at runtime.
Is the _del_ method of each object called when the programs ends?
If yes I could for example do something like this:
class Client:
__del__( self ):
disconnect_from_server()
...
Hi, I have a generic foreign key in one of my models:
# models.py
class Tasks(models.Model):
content_type = models.ForeignKey(ContentType, limit_choices_to=tasktype_limits, null=True, blank=True)
object_id = models.PositiveIntegerField(null=True, blank=True, )
target = generic.GenericForeignKey('content_type', 'objec...
I'm using pylons, and using this command to start the server:
paster serve --reload development.ini
I found when I modify something, the paster will reload the application. In the console, it shows:
-------------------- Restarting --------------------
Starting server in PID 7476.
serving on http://127.0.0.1:5000
This is convenient ...
I want to add images to wx.Dialog (and then sizer) some like wx.ImageList and display it dinamically. But I don't want to change already displayed image, I want to add next.
How can I resolve this problem?
...
Hi,
I have a problem with ModelChoiceField, it re-runs the query set every time, I am trying to cache my querysets here and I noticed that ModelChoiceIterator uses queryset.all() when iterating, which creates a new queryset, without cached data, and triggers a fresh query on the database.
Is there any way past that?
I am using cached...
How to integrate http://ajaxim.com/ to a django module
Small piece of code would be helpful
...
OK, so I'm writing a framework that looks for python files in sub directories that are named task.py and then look for classes that are derived from the base class Task and collect them.
I decided that I needed to add a meta class to Task, but then the issubclass() started to behave in a weird way.
Here is how the directory layout looks:...
I start with the following list s and bitmask b:
s = ['baa', 'baa', 'black', 'sheep', 'have', 'you', 'any', 'wool']
b = [1, 0, 0, 0, 1, 1, 1, 0] # or any iterable with boolean values
How do I write some function apply_bitmask(s, b) so that it returns
['baa', 'have', 'you', 'any']
...
Any suggestions on how to get events from Facebook connected to a user in JSON with Python?
All documentation seems to be directed against building Facebook applications. My goal is to show an events listing on a web page.
...
i want to do router configuration using python , but dont want to use any application level protocol to configure it . Is it possible to deal it on a hardware level ? Please do tell if the question is vague or if it needs more explanation , then I would put more details on as to what I have my doubt in
...
Hi
I have found out that you can't open(filepath) when filepath length is bigger that 255 even if the filename itself is 10 characters long( the remaining part is the directory path).
Any idea to work around this issue?
(python 2.6 on win32)
...
Is there a .net equivalent for urllib I used in Python?
I've seen WebRequest and WebResponse classes but I wonder if there is a simpler wrapper. In urllib you can use dictionary object (tupple) to set POST parameters while in .Net one must fiddle with streams.
Is there any free, small web client library available for .net?
...
PyPi shows matplotlib 1.0.0. However, when I install matplotlib via pip into a virtualenv, version 0.91.1 is installed.
Why the difference in versions?
Is there a way to pip install matplotlib 1.0.0?
Research
It appears that matplotlib's DOAP record on PyPi is pointing to the correct version. Below is the DOAP record for reference:...
Hello all,
I am just wondering if there is a way to add breakpoints in IDLE so that I can stop at a point in my script and write other lines in the idle shell for testing. If not, is there other software that can do this?
...
Hello...
I have some bash scripts, some simple ones to copy, search, write lines to files and so on.
I am an Ubuntu. and I've searched in google, but it seems that everybody is doing that on python.
I could do these on python, but since I am not a python programmer, I just know the basics.
I have no idea of how calling a sh script from...
Hello,
I am python newbie and am still discovering its wonders.
I wrote a script which renames a number of files :
from Edison_03-08-2010-05-02-00_PM.7z to Edison_08-03-2010-05-02-00_PM.7z
"03-08-2010" is changed to "08-03-2010"
The script is:
import os, os.path
location = "D:/codebase/_Backups"
files = os.listdir(location)
for old...
I'm using the urllib2.urlopen method to open an url and fetch the markup of a webpage. Some of these sites redirect me using the 301/302 redirects. I would like the know the final URL that I've been redirected to. How can i get this?
Thanks
...
I'm trying to write a GUI that reads in settings for a python-script, then generates the script and runs it. The script can take dozens of minutes to run so in order to not block the GUI and frustrate the user I'm running it in a separate thread. Before I did this I used a separate class to redirect the std.out and std.err of the program...
I have a sql database and am wondering what command you use to just get a list of the table names within that database.
...
I need to write a python application with use both of the mysql and sql server is there
a general python module or library that can access both mysql and sql server as DBI with perl or should i use 2 libraries and if yes which libraries do you recommend .
...