It is sometimes beneficial to share certain constants between various code files in a django application.
Examples:
- Name or location of dump file used in various modules\commands etc
- Debug mode on\off for the entire app
- Site specific configuration
What would be the elegant\pythonic way of doing this?
...
Hello,
i am keen to know whether we can generate a DTMF tones using python? If yes then is there any library to do so? I have checked on the net there i could find sample program to decode the DTMF tones but not vice-versa. It would be great if anyone can give me some hint.
Thanks,
Rupesh
...
Hi ,
I have started using django very recently . I am building a service with user login.
Login , I am sending as POST service. There is a template to render , once the user is logged in.
But the browser address is not getting updated.
eg : abc.com the root my form would be something like
"form action="/login" .....>"
...
hi!
I'm trying make my first python app. I want make simple email sender form.
In qt designer create a dialog.ui, then generate dialog.py from dialog.ui
and write there function
def SendEmail(self,efrom,eto,esubj,ebody):
msg = MIMEText( ebody.encode('UTF-8'),'html', 'UTF-8')
msg['Subject'] = esubj
msg['From'] = efrom
msg...
Hi,
Amazingly, in bash, you can do
$ curl http://mp3.streampower.be/radio1-high.mp3 > test.mp3
with an audiostream and then ^C out, and you will have a working mp3 file, leading me to believe I could have this automated in python, but I can't find how.
If i just do
file('python.mp3', 'w').write(urllib2.urlopen("http://mp3.streampo...
Hi All,
I am working on a Google app engine project where I have saved some images in the datastore.
Now I have to resize these images and render them to the template. I have successfully fetched the images but I am not getting,how to render them with other data dictionaries to the template. I am using App engine patch with GAE.
Follo...
how to process an audio file using python
...
Hi.
I need to download files from the internet. For that I am using subprocess and calling wget. Is this the right way? The files are hosted on static links and there is no need to log in or anything.
I glanced over urllib but I could not find any example of it being used to download files of other types.
Any suggestions?
...
Hello
I've got some problems with a script I'm writing.
#!/usr/local/bin/python
import MySQLdb
ConvDB = MySQLdb.Connect(host="1.1.1.1", user="123", passwd="123", db="somedb")
ConvDBcursor = ConvDB.cursor()
query="SELECT id from sometable WHERE somethng=63"
print query
ConvDBcursor.execute(query.decode('cp1251').encode('utf8'))
print...
I am trying to wrap a C library using ctypes. One feature of the library is an ondestroy callback which is called when a handle returned by the library is about to be destroyed.
The callback has the signature:
void cb(f *beingdestroyed);
The API allows one to associate a user-specified void * with f when it is returned by the librar...
Hello all. I have a script and I want to code it so that it becomes active every hour on the half hour. This is the code I have so far.
from ConfigParser import *
import emailModule
from datetime import datetime
import time
configuration = ConfigParser()
configuration.read('Email.conf')
email = emailModule.emailModule(configuration)
...
I am posting to Hudson server using curl from the command line using the following--
curl -X POST -d '<run><log encoding="hexBinary">4142430A</log><result>0</result><duration>2000</duration></run>' \
http://user:pass@myhost/hudson/job/_jobName_/postBuildResult
as shown in the hudson documentation..can I emulate the same thing using p...
Using Blender 2.49's Python API I'm creating a mesh.
I have a list of vertices and a list of face indices.
e.g.
mesh = bpy.data.meshes.new('mesh')
mesh.verts.extend(mVerts)
mesh.faces.extend(mFaces)
I've noticed MVert's uvco property and MFace's uv
property, and added some random values, but I can't see any
change when I render.
Re...
I'm writing a webblog app in Django. I currently have 2 models Post and PostMeta. Post is a standard post style model with fields such as author, title, content etc. It also contains a single many-to-many field called post_meta which is associated with my second model PostMeta. PostMeta is a simple name/value model with two fields, meta_...
I want to assign a value to each letter in the alphabet, so that a -> 1, b -> 2, c -> 3, ... z -> 26. Something like a function which returns the value of the letter, for example:
value('a') = 1
value('b') = 2
etc...
How would I go about doing this in python?
...
My system is Mac OS X 10.5.8 and I have installed python from http://www.python.org/ftp/python/2.5.4/python-2.5.4-macosx.dmg because I do not want to use System python (python which already comes installed with Mac OS X) and have totally removed system python.
Now when I try to install pyobjc it installs, but on import gives error
Pyth...
I'm trying to learn about parsers, for Python, C and C++ source (on my own, not for a school project). Here is a summary of what i want to do:
1) read .c/.cpp/.py source files in Python
2) get a list of all the functions in the source files, and the span of their definitions in terms of line numbers.
So to illustrate my question, con...
is there any frame-work or tool to test java-applets in python
...
I'm trying to create a COM Object from a dll in a new thread in Python - so I can run a message pump in that thread:
from comtypes.client import CreateObject
import threading
class MessageThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.daemon = True
def run(self):
pri...
Let's say I have the following HTML:
<div>
text1
<div>
t1
</div>
text2
<div>
t2
</div>
text3
</div>
I know of how to get the text and subelements of the enclosing div using lxml.html. But is there a way to access both text and sub elements in an iterative manner, that preserves order? In other words, I want to know where the "fr...