Using Django 1.0.1, Python 2.6.2 (linux)
From some examples from the internet I made the test code below. It works!
... BUT if I reload the page, the pie will draw itself in the same image. Some parts get darker every time I reload the page. When I restart the the development server, it is reset. How do I draw properly with matplotlib...
For a given file
For ex : 11 ,345 , sdfsfsfs , 1232
i need to such above records from a file , read 11 to delimiter and strip the white space and store in the another file , similarly 345 to delimiter strip the while space and store in the file. This way i need to do for multiple rows.
so finally in the other file the data should ...
I have a python module which generates large data files which I want to cache on disk for future use. The cache is likely to end up some hundreds of MB for a normal user, but save a lot of computation time.
The files aren't distributed with the module, but are generated the first time the code is run with a given set of parameters.
So ...
Are there any good alternatives to SQLite + FTS3 for python?
I'm iterating over a series of text documents, and would like to categorize them according to some text queries. For example, I might want to know if a document mentions the words "rating" or "upgraded" within three words of "buy." The FTS3 syntax for this query is the followi...
when i deploy my apps that worked fine using the django test server I usually get errors for every package I installed using pip install -e ....#egg=foo. I usually do this using virtualenv, which placed the files into env/src/foo and places another file into python/site-packages (this is an example of django-css):
django-css.egg-link, w...
I need to create a secure channel between my server and a remote web service. I'll be using HTTPS with a client certificate. I'll also need to validate the certificate presented by the remote service.
How can I use my own client certificate with urllib2?
What will I need to do in my code to ensure that the remote certificate is corre...
My module currently imports the json module, which is only available in 2.6. I'd like to make a check against the python version to import simplejson, which can be built for 2.5 (and is the module adopted in 2.6 anyway). Something like:
if __version__ 2.5:
import simplejson as json
else:
import json
What's the best way to appr...
I'm trying to setup a fabfile to deploy my Django app.
I can't figure out why I'm getting this error:
Fatal error: local() encountered an error (return code 2) while executing 'git commit -m 'changed settings for prodserver'
$ fab create_branch_deploy_to_prodserver
[localhost] run: git checkout prodserver_server
[localhost] run: git me...
I see a lot of people with Django apps that have image uploads are automatically resizing the images after they are uploaded. That is well and good for some cases, but I don't want to do this. Instead, I simply want to force the user to upload a file that is already the proper size.
I want to have an ImageField where I force the user t...
When inckuded the following in urls.py
(r'^settings/users/change_password/$', 'django.contrib.auth.views.password_change'
The following shows up on the screen,
Reverse for '' with arguments '()' and keyword arguments '{}' not found.
And i am trying to give the access to users to change their passwords.
Whats wrong with the above cod...
I'm having trouble toggling panes with the AUIManager.
Here's basically what I'm doing:
class foo(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=wx.Size(800,600))
self.menubar = wx.MenuBar()
self._mgr = wx.aui.AuiManager(self)
self._mgr.AddPane(self....
I'm trying to dynamically create a bunch of class properties, but each dynamic fget accessor needs a unique local variable.
Here is a simplified example:
class Test(object):
def __metaclass__(name, bases, dict):
for i in range(5):
def fget(self, i=i):
return i
dict['f%d' % i] = prope...
Hi
I have created different shapes like circle/rect etc in my program using BufferedPaintDC on event. Now i want to save the file as I click the saveas button in the menu option. For that I am using memoryDC and save the contents as bmp file.
def Saveas(self,event):
dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.*...
Using str.format() is the new standard for formatting strings in Python 2.6, and Python 3. I've run into an issue when using str.format() with regular expressions.
I've written a regular expression to return all domains that are a single level below a specified domain or any domains that are 2 levels below the domain specified, if the 2...
I'm using Elixir in a project that connects to a postgres database. I want to run the following query on the database I'm connected to, but I'm not sure how to do it as I'm rather new to Elixir and SQLAlchemy. Anyone know how?
VACUUM FULL ANALYZE table
Update
The error is: "UnboundExecutionError: Could not locate a bind configured on ...
I have a list of dictionaries that have the same keys within eg:
[{k1:'foo', k2:'bar', k3...k4....}, {k1:'foo2', k2:'bar2', k3...k4....}, ....]
I'm trying to delete k1 from all dictionaries within the list.
I tried
map(lambda x: del x['k1'], list)
but that gave me a syntax error. Where have I gone wrong?
...
I am working with a file uploaded using Django's forms.FileField. This returns an object of type InMemoryUploadedFile.
I need to access this file in universal-newline mode. Any ideas on how to do this without saving and then reopening the file?
Thanks
...
Hey,
I've just started to learn Python and I'm creating the game Hangman. I've got the basic functionality down. I have a list containing the words and they're randomly selected. I have an input for the user to guess letters and check it against the list that the word is split into, I have another list that the correctly guessed letters...
Here is a mockup of what I want to do:
alist = [1,2,3,4,5] # create a vanilla python list object
replacef (alist) # replace __setitem__, extend,... with custom functions
alist[0]=2 # now the custom __setitem__ is called
This is for a DSL project where the syntax should be as close to normal python as possible, so sub...
EDITED:
import pickle
filename=input('Enter a file name:')
def entoles():
f=open(filename,'w')
names=[]
grades=[]
while True:
name=input("Give a student's name:")
if name.lower()=='end':
f.close()
print("File closed")
print("Back to M...