I am just wondering if there is a super global(like PHP) in python. I have certain variables i want to use throughout my whole project in separate files, classes and functions and i don't want to have to keep declaring it throughout each file.
...
I have a django site, and some of the feeds are published through FeedBurner. I would like to ping FeedBurner whenever I save an instance of a particular model. FeedBurner's website says to use the XML-RPC ping mechanism, but I can't find a lot of documentation on how to implement it.
What's the easiest way to do the XML-RPC ping in dja...
I have a GUI program,
It auto create buttons from a name list,
and connect to a function prints its name.
but when I run this program, I press all the buttons,
they all return the last button's name.
I wonder why this thing happens. can any one help?
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import logging
...
Does anyone has an experience of reading and writing ID3 tags in an MP3 file or a WMA file? There are some libraries but I would like to do it from the scratch. :-)
...
So I wanted to introduce a friend to the wonderful world of python ORM libraries, which I still know little about.
Our databases are extremely fragmented and at times under normalized (for efficiency) and over normalized. Making "entities" out of it at this point is too much work (we have lots of legacy php code working with this) so th...
After some tweaking of some code I got from someone to cause a characters images to move in regards to its direction and up down left right input I've put this together: (hope the code isn't too messy)
Character Move Code + IMG
The Sprite sheet only runs lengthwise, so basically each sprite section is a different action. Now would ther...
Hi all
I'm in the middle of reworking our build scripts to be based upon the wonderful Waf tool (I did use SCons for ages but its just way too slow).
Anyway, I've hit the following situation and I cannot find a resolution to it:
I have a product that depends on a number of previously built egg files.
I'm trying to package the produ...
I've written a web-app in python using SQLite and it runs fine on my server at home (with apache and python 2.5.2). I'm now trying to upload it to my web host and there servers use python 2.2.3 without SQLite.
Anyone know of a way to use SQLite in python 2.2.3 e.g. a module that I can upload and import? I've tried butchering the module f...
I'm writing an "envirorment" where each variable is composed by a value and a description:
class my_var:
def __init__(self, value, description):
self.value = value
self.description = description
Variables are created and put inside a dictionary:
my_dict["foo"] = my_var(0.5, "A foo var")
This is cool but 99% of operat...
Hello folks, this is a follow up to this. (You don't have to read all the answers, just the question)
People explained to me the difference between processes and threads. On the one hand, I wanted processes so I could fully exploit all core of the CPU, on the other hand, passing information between processes was less than ideal, and I d...
I understood that in certain Windows XP programs, like Photoshop, there is something called "scratch disks". What I understood that this means, and please correct me if I'm wrong, is that Photoshop manages its own virtual memory on the hard-drive, instead of letting Windows manage it. I understood that the reason for this is some limitat...
Let's say I have some contrived models:
class Author(Model):
name = CharField()
class Book(Model):
title = CharField()
author = ForeignKey(Author)
And let's say I want to use a ModelForm for Book:
class BookForm(ModelForm):
class Meta:
model = Book
Simple so far. But let's also say that I have a ton of ...
I've been trying to get Django running and when going through the intro to projects it seems that I keep having trouble when I get to the 'sync database' section. When using InstantDjango this doesn't seem to be as much of a problem. My question is, can one just do Django development with the InstantDjango program or do you really need ...
PHP classes can use the keyword "self" in a static context, like this:
<?php
class Test {
public static $myvar = 'a';
public static function t() {
echo self::$myvar; // Generically reference the current class.
echo Test::$myvar; // Same thing, but not generic.
}
}
?>
Obviously I can't use "self" in this way in Python b...
Scenario:
There is a complex piece of software that is annoying to launch by hand. What I've done is to create a python script to launch the executable and attach gdb for debugging.
The process launching script:
ensures an environment variable is set.
ensures a local build directory gets added to the environment's LD_LIBRARY_PATH var...
I've got the following installed through MacPorts on MacOS X 10.5.6:
py25-sqlite3 @2.5.4_0 (active)
python25 @2.5.4_1+darwin_9+macosx (active)
sqlite3 @3.6.12_0 (active)
python25 is correctly set as my system's default Python.
I downloaded a fresh copy of Django 1.1 beta (I have the same problem with 1.0 and trunk, though) and instal...
I'm wondering if there is a quick and easy way to output ordinals given a number in python.
For example, given the number 1, I'd like to output "1st", the number 2, "2nd", et cetera, et cetera.
This is for working with dates in a breadcrumb trail
Home > Venues > Bar Academy > 2009 > April > 01
is what is currently shown
I'd li...
I'm using Django 1.0.2. I've written a ModelForm backed by a Model. This model has a ForeignKey where blank=False. When Django generates HTML for this form it creates a select box with one option for each row in the table referenced by the ForeignKey. It also creates an option at the top of the list that has no value and displays as ...
Hi all,
Im writing a little python program that goes through an XML file and does some replacement of tags. It takes three arguments, a path from whcih it creates a directory tree, the XML file its reading and the xml file its outputting to. It works fine from the command line just passing in arguments. As its not just for me, i thought...
I put the following in my settings.py file. The email address there is a test one. I found the email settings from Webfaction's site:
EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = 'hekevintran_test'
EMAIL_HOST_PASSWORD = 'testpass'
EMAIL_PORT = 465
EMAIL_USE_TLS = True
This is what my file looks like:
from django.core.mail ...