In the emacs Python shell (I'm running 2.* Python) I am importing a .py file I'm working with and testing the code. If I change the code however I'm not sure how to import it again.
From my reading so far it seems that
reload(modulename)
should work, but it doesn't seem to.
Perhaps just shutting down the python shell and restarti...
I am creating a medium level application in Python.
Everything works well now, and I am trying to make this a windows executable with py2exe.
The executable is created fine, but when I try to run it, it fails with the following error.
File "zipextimporter.pyo", line 82, in load_module
File "ffhandler.pyo", line 33, in ?
File "zipe...
In a django application I have the following model:
class Appointment(models.Model):
#some other fields
#address fields
zipcode=models.CharField(max_length=5)
address=models.CharField(max_length=120)
latitude=models.FloatField()
longitude=models.FloatField()
When I'm rendering an Appointment, I'm just putting a...
In the Python data model reference section on slots there is a list of notes on using __slots__. I am thoroughly confused by the 1st and 6th items, because they seem to be contradicting each other.
First item:
When inheriting from a class without
__slots__, the __dict__ attribute
of that class will always be
accessible, so a __slots...
Good Afternoon,
I'm currently trying to build something incredibly simple inside of the Google AppEngine. The goal is to build a simple photo sharing application that will connect back to my iPhone application. It's all a learning experience for both Python and Objective-C.
(I've been a PHP programmer for quite some time).
The goa...
I have a C++ app that I'm developing with wxGTK 2.9.0 on Ubuntu 9.10. The app also uses the Python 3.1 api. The source files compile just fine but when it comes to linking, I get errors saying that xxx has already been defined, where xxx is a member function in the classes. There are many of these errors. The only libraries I'm linking w...
Suppose my model looks like this:
class Farm(models.Model):
name = ...
class Tree(models.Model):
farm = models.ForeignKey(Farm)
...and I get a QuerySet of Tree objects. How do I determine what farms are represented in that QuerySet?
...
This code opens the url and appends the /names at the end and opens the page and prints the string to test1.csv:
import urllib2
import re
import csv
url = ("http://www.example.com")
bios = [u'/name1', u'/name2', u'/name3']
csvwriter = csv.writer(open("/test1.csv", "a"))
for l in bios:
OpenThisLink = url + l
response = urllib2....
Hi,
I'm trying to use multiprocessing's Pool.map() function to divide out work simultaneously. When I use the following code, it works fine:
import multiprocessing
def f(x):
return x*x
def go():
pool = multiprocessing.Pool(processes=4)
#result = pool.apply_async(self.f, [10])
#print result.get(timeou...
How can I integrate pylint with netbeans?
...
Is there a way to get object.__doc__ as a raw string, apart from adding an 'r' in-front of the doctring itself in the source code?
I have latex code inside and the '\r's, '\f's etc are creating problems.
...
I have the following variables declared in a lot of functions, as I need those values in each one of them. Is there anyway I can declare them at a global scope or something, such as I won't have to declare them in all my methods? I am using all this methods on instance methods of a class of mine.
x = 0
y = 1
t = 2
In c# I'd just decla...
I'm trying to learn myself the super() function in Python.
I though I got a grasp of it untill I came over this example (2.6) and found myself stuck.
http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html#super-with-classmethod-example
Traceback (most recent call last):
File "<stdin>", line 1,...
I am trying to scrape
http://www.co.jefferson.co.us/ats/displaygeneral.do?sch=000104
and get the "owner Name(s)"
What I have works but is really ugly and not the best I am sure, so I am looking for a better way.
Here is what I have:
soup = BeautifulSoup(url_opener.open(url))
x = soup('table', text = re.compile("Owner Name"))...
I've been trying to override the default __unicode__() method for the django.contrib.auth.models User model but I can't get it to work.
I tried it like this:
from django.db import models
from django.contrib.auth.models import User
class User(models.Model):
def __unicode__(self):
return "pie"
and
from django.db i...
In Pinax, when
ACCOUNT_OPEN_SIGNUP = False
how does the admin invite more users to the system?
How does one generate invitation codes? How do they work?
...
Hi all,
I have made a pygame application, which I sucessfuly compiled to an exe using the pygame2exe script from pygame website.
Now I made a small launcher with startup options for the application, using Tkinter, and everything work smoothly.
The problem comes when I try to compile the application to exe, using the same script as abo...
I'm getting a
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 34: ordinal not in range(128)
on a string stored in 'a.desc' below as it contains the '£' character. It's stored in the underlying Google App Engine datastore as a unicode string so that's fine. The cStringIO.StringIO.writelines function is t...
I'm looking for an API (or some information as to where to look/start) that will ultimately allow me to monitor sound being played by the computer.
My end goal (well, certain to eventually be a stepping-stone) is an oscilloscope.
Where should I begin to look (aside from Google, which has yielded unsatisfactory results) to learn more a...
I'm trying to get started using Python for KDE development. What is the canonical source for PyKDE4 reference documentation? The Python page of KDE TechBase is surprisingly sparse on details, and googling hasn't helped.
...