Hello,
I've written an application using wxPython and various other small modules (xlrd, xlwrt, pyserial, etc.) xlrd/xlwt i believe use a BSD license, and wxPython..
""Being a wrapper, wxPython uses the same free software licence
used by wxWidgets (wxWindows License)—which is approved by Free
Software Foundation and Open Source ...
I need fastest way to convert files from latin1 to utf-8 in python. The files are large ~ 2G. ( I am moving DB data ). So far I have
import codecs
infile = codecs.open(tmpfile, 'r', encoding='latin1')
outfile = codecs.open(tmpfile1, 'w', encoding='utf-8')
for line in infile:
outfile.write(line)
infile.close()
outfile.close()
but ...
How can I test if the string is empty in Python?
For example,
"<space><space><space>" is empty, so is
"<space><tab><space><newline><space>", so is
"<newline><newline><newline><tab><newline>", etc.
...
Hi there,
is possible to make own help message or attach own event on help option using optparse module in Python?
...
I want to override the __getattr__ method on a class to do something fancy but I don't want to break the default behavior.
What's the correct way to do this?
...
Hello,
I use the memcache extension for python, and I have a very strange problem. Memcached refuses to store the exact same data with some keys, and succeeds in caching some others.
>>> import memcache
>>> conn = memcache.Client('121.0.0.1:11211', debug=0)
>>> conn.set('138b9c95d693760840aab85ee5591d2', 'test');
True
>>> conn.set('138...
Hi,
how do I switch between my window manager's workspaces using Python with Xlib module?
I've been searching Google the last couple of hours, and this is my most promising attempt:
#!/usr/bin/python
from Xlib import X, display, error, Xatom, Xutil
import Xlib.protocol.event
screen = Xlib.display.Display().screen()
root = screen.r...
I am wondering how I can go about stopping a dialog from opening if certain conditions are met in its __init__ statement.
The following code tries to call the 'self.close()' function and it does, but (I'm assuming) since the dialog has not yet started its event loop, that it doesn't trigger the close event? So is there another way to c...
Hi,
I'd like to know how to traverse an object graph in python from a String, is there any project or feature like OGNL (http://www.opensymphony.com/ognl/) or BeanUtils (http://commons.apache.org/beanutils/) in Java?
Basicaly I need to write a string "property.innerproperty = True" or "property = 'xpto'" and process it from a root obje...
I know what I'm looking for. I want python to tell me which list it's in.
Here's some pseudocode:
item = "a"
nested_list = [["a", "b"], ["c", "d"]]
list.index(item) #obviously this doesn't work
here I would want python to return 0 (because "a" is an element in the first sub-list in the bigger list). I don't care which sub-element...
What is your opinion of using the infix operator hack in production code? Issues:
The effect this will have on speed.
The potential for a clashes with an object with these operators already defined. This seems particularly dangerous with generic code that is intended to handle objects of any type.
It is a shame that this isn't built ...
While other questions have tackled the broader category of sequences and modules, I ask this very specific question:
"What naming convention do you use for dictionaries and why?"
Some naming convention samples I have been considering:
# 'value' is the data type stored in the map, while 'key' is the type of key
value_for_key={key1:valu...
I'm working with a project that contains about 30 unique modules. It wasn't designed too well, so it's common that I create circular imports when adding some new functionality to the project.
Of course, when I add the circular import, I'm unaware of it. Sometimes it's pretty obvious I've made a circular import when I get an error like A...
If I have a string that looks like either
./A/B/c.d
OR
.\A\B\c.d
How do I get just the "./A/B/" part? The direction of the slashes can be the same as they are passed.
This problem kinda boils down to: How do I get the last of a specific character in a string?
Basically, I want the path of a file without the file part of it.
...
I am looking to setup a automated screen scraper that will run on Google app engine using python. I want it to scrape the site and put the specified results into a Entity in app engine. I am looking for some directions on what to use. I have seen beautifulsoup but wonder if people could recommend anything else that could run on Google Ap...
Hi, I'm new here and on python too, and i need a code to login an HTTPS webpage
the page is: ritaj.birzeit.edu
and how can i know if its correct username or password , can you help in this :)
...
I create a fifo:
mkfifo tofetch
I run this python code:
fetchlistfile = file("tofetch", "r")
while 1:
nextfetch = fetchlistfile.readline()
print nextfetch
It stalls on readline, as I would hope. I run:
echo "test" > tofetch
And my program doesn't stall anymore. It reads the line, and then continues looping forever. Why w...
I'm attempting to implement a Patricia Trie with the methods addWord(), isWord(), and isPrefix() as a means to store a large dictionary of words for quick retrieval (including prefix search). I've read up on the concepts but they just aren't clarifying into an implementation. I want to know (in Java or Python code) how to implement the T...
I think I'm using the Users API incorrectly:
class BaseHandler(webapp.RequestHandler):
user = users.get_current_user()
def header(self, title):
if self.user:
render('Views/link.html', self, {'text': 'Log out', 'href': users.create_logout_url('/')})
else:
render('Views/link.html', self, {'text': 'Log in',...
I want to scrape this URL : https://www.xstreetsl.com/modules.php?searchSubmitImage_x=0&searchSubmitImage_y=0&SearchLocale=0&name=Marketplace&SearchKeyword=business&searchSubmitImage.x=0&searchSubmitImage.y=0&SearchLocale=0&SearchPriceMin=&SearchPriceMax=&SearchRatingMin=&SearchRatingMax=&s...