what are some good books/tutorials online that show python's use in web development. I dont want to start out with django. I want to actually get to the meat and do some examples myself then I can start messing with django.
I looked at dive into python3 but only chapter it has that is somewhat relavant to the web is web services. wha...
Hello,
For my GAE app I need to do some natural language processing to extract the subject and object from an input sentence.
Apparently NLTK can't be installed (easily) on GAE so I am looking for another solution.
I noticed GAE comes with Antlr3 but from browsing their documentation it solves a different kind of grammar problem.
Any...
Is there any way to manually remove an object which the garbage collection refuses to get rid of even when I call gc.collect()? Working in Python 3.0
...
When I extended some tool generated classes, I didn't realize that they are old style classes until I tried to use super(). The super() doesn't work with old style classes, so I got this error:
TypeError: super() argument 1 must be type, not classobj
E.g., try this snippet:
>>> class A:
... def greet(self):
... print "A s...
If string "x" contains any letter or number, print that string.
How to do that using regular expressions?
Below is wrong?
if re.search('^[A-Z]?[a-z]?[0-9]?', i):
print i
...
It doesn't say it anywhere in the documentation, it only shows how to parse the tags.
...
Short Question:
Lets say, I want to solve Project Euler problem 9 using python and some equation solving libraries.
a + b + c = 1000.
a2 + b2 = c2
How do you do it.
Long Question:
I want to solve a set of equations; linear, sometimes may be quadratic too. Not a specific problem; but often, I have been in situation I wanted to.
I...
I have a normal Django site running. In addition, there is another twisted process, which listens for Jabber presence notifications and updates the Django DB using Django's ORM.
So far it works as I just call the corresponding Django models (after having set up the settings environment correctly). This, however, blocks the Twisted app, ...
Many frameworks keep their configuration files in a language different from the rest of the program. Eg, Appengine keeps the configuration in yaml format. to compare, DJango settings.py is a python module. There are many disadvantages I can see with this.
If its in same language as rest of the program, I can
Do interesting things in th...
Hi,
I have model
class info(db.Model):
user = db.UserProperty()
last_update_date = db.DateTimeProperty()
I need to retrieve last_update_date for specific user. It is working good, i can retrieve this value, i can even pass it to another variable
if results:
for result in results:
data = result.last_up...
Hi,
I noticed something strange when creating shared contact using google contacts api.
This is code i am using to create contact:
def AddEmail(name ,email):
new_contact = gdata.contacts.ContactEntry(title=atom.Title(text=name))
new_contact.email.append(gdata.contacts.Email(address=email,
...
I would like to delete selected columns in a numpy.array . This is what I do:
n [397]: a = array([[ NaN, 2., 3., NaN],
.....: [ 1., 2., 3., 9]])
In [398]: print a
[[ NaN 2. 3. NaN]
[ 1. 2. 3. 9.]]
In [399]: z = any(isnan(a), axis=0)
In [400]: print z
[ True False False True]
In [401]: delete(a, z, ax...
How would I go about extending the default User model with custom managers?
My app has many user types that will be defined using the built-in Groups model. So a User might be a client, a staff member, and so on. It would be ideal to be able to do something like:
User.clients.filter(name='Test')
To get all clients with a name of Test...
I put this at the top, using "sudo vi /etc/profile":
PYTHONPATH=/home/myuser:/home/myotheruser
When I use putty and log in under my username, the python path does not work!
I type "set", and it is there. But, importing things from that directory still does not work.
When I manually do this, then it will work.
EXPORT PYTHONPATH=/home...
Hi. I'm currently trying to do some introspection on a DLL with python. I want to create automatically a graphical test interface based on a DLL.
I can load my DLL in python quite easily and I call some functions. The main problem is if I call "dir" on the object without calling any method, I've got in result
>>> dir(myLib)
['_FuncPtr'...
Hello guys.
What is the best way to organize code that belongs to the same project in a Python development environment? What are the do and donts of Python project organization? Do you separate each class in a file?
Project A
Classes
"subsystem1"
class1
class2
subsystem1Module
"subsyst...
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 38: ordinal not in range(128)
I am downloading a website and then printing its contents...simple.
Do I have to encode it somehow?
...
Consider the following Django models:
class Host(models.Model):
# This is the hostname only
name = models.CharField(max_length=255)
class Url(models.Model):
# The complete url
url = models.CharField(max_length=255, db_index=True, unique=True)
# A foreign key identifying the host of this url
# (e.g. for http://w...
I have the following vehicle data
vehicle_id, position_x, position_y, time
The data represents the position of a vehicle at time 't' . The data is also available as a linear reference. I was wondering what's a simple way to visualize the vehicle movement as an animation? I would prefer a solution that I can integrate with python
EDIT...
Hi,
I am using python 2.5 and trying to use an self defined excepthook in my program. In the main thread it works perfectly fine but in an thread started with the threading module the usual excepthook is called.
Here is a example showing the problem. Uncommenting the comment shows the desired behaviour.
import threading, sys
def myexc...