I'm developing a project on google app engine (webapp framework). I need you people to assess how I handle exceptions.
There are 4 types of exceptions I am handling:
Programming exceptions
Bad user input
Incorrect URLs
Incorrect query strings
Here is how I handle them:
I have subclassed the webapp.requesthandler class and overrode...
I have this script-
import lxml
from lxml.cssselect import CSSSelector
from lxml.etree import fromstring
from lxml.html import parse
website = parse('http://xxx.com').getroot()
selector = website.cssselect('.name')
for i in range(0,18):
print selector[i].text_content()
As you can see the for loop stops after a number of ti...
I am writing a decorator that needs to call other functions prior to call of the function that it is decorating. The decorated function may have positional arguments, but the functions the decorator will call can only accept keyword arguments. Does anyone have a handy way of converting positional arguments into keyword arguments?
I kn...
Let's say I wanted to remove vowels from HTML:
<a href="foo">Hello there!</a>Hi!
becomes
<a href="foo">Hll thr!</a>H!
I figure this is a job for Beautiful Soup. How can I select the text in between tags and operate on it like this?
...
I'm looking for an open source, pure Python library that supports the SyncML protocol, at least enough to implement a SyncML client.
...
I'd like to create a COM server that can hold it state across the calls. My goal is to have a thread-safe in-memory database. And provide an access to it via COM interface.
Is that possible?
...
I'd like to serve django application on windows XP/Vista.
The application is an at hoc web interface to a windows program so it won't be put under heavy load (around 100 requests per second).
Do you know any small servers that can be easily deployed on windows to serve a django app? (IIS is not an option as the app should work on all ve...
I am trying to telnet into a server using Python on Windows XP. I can connect successfully by typing 'telnet HOST PORT' which creates an anonymous connection. But Python's telnetlib.Telnet(HOST, PORT) returns 'Connection refused'. Telnetting in Java also fails. Spelunking shows that Python tries to create an anonymous socket connecti...
I am using turtle graphics through Python. My image is too large for the turtle window. I had to enlarge the image because the text I need at each spot overlaps. I have a few ideas on how to make the image fit inside the window, but I can't get any of them to work.
Resize the window
Resize the text
Set bottom left and top right coordin...
I created my own Auth app, and now Admin is not working, what can you suggest?
Exception now is: 'User' object has no attribute 'is_authenticated'
I know my User really have no such method. So I have 2 ways:
- change admin
- adapt my user system
My question was: is there possibility to easily off admin bound to auth
...
Given a package, how can I automatically find all its sub-packages?
...
A good friend just sent me the following email
My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, he’s proposing they teach web design and web development. My question is in your opinion what are the “industry standard” tools for both web design and web develo...
Not exactly about programming, but I need help with this.
I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.
However, from what I gathered (I may be wrong...
Hi,
I'm trying to launch a website url in a new tab using python in that way, but it didn't worked in these both ways:
Method 1:
os.system('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');
and Method 2:
os.startfile('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');
If ...
I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.
Are there hashing algori...
I want to be able to log into a website programmatically and periodically obtain some information from the site. What is the best tool(s) that would make this as simple as possible? I'd prefer a Python library of some type because I want to become more proficient in Python, but I'm open to any suggestions.
...
I know PDF generation has been discussed a lot here; however, I've yet to find what I need.
I'm trying to generate PDF reports (mainly tables) from python. Yes I've tried ReportLab and Pisa. Both had column content "break out" in circumstances I didn't think were unreasonable and unrealistic to encounter in production.
When I say r...
I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create a Windows service.
I installed it on a computer running Windows XP Pro SP3. However, I can't connect to it when it's running as a service. I can confirm that it's binding to the address/port, because I get a conflict when I try to bind to tha...
The "yield" statement in python allows simple iteration from a procedure, and it also means that sequences don't need to be pre-calculated AND stored in a array of "arbitrary" size.
Is there a there a similar way of iterating (with yield) from a C procedure?
...
Hey
I have a scheduled task which runs a python script every 10 min
so it turns out that a script pops up on my desktop every 10 min
how can i make it invincible so my script will work in the background ?
I've been told that pythonw will do the work, but I cant figure out how to use it
any help ?
thanks
...