hi there,
many webpages use onload JavaScript to manipulate their DOM. Is there a way I can automate accessing the state of the HTML after these JavaScript operations?
A took like wget is not useful here because it just downloads the original source.
Is there perhaps a way to use a web browser rendering engine?
Ideally I am after a s...
Does anyone know of a library for fixing "broken" urls. When I try to open a url such as
http://www.domain.com/../page.html
http://www.domain.com//page.html
http://www.domain.com/page.html#stuff
urllib2.urlopen chokes and gives me an HTTPError traceback. Does anyone know of a library that can fix these sorts of things?
...
How can I iterate over a list of all classes loaded in memory?
I'm thinking of doing it for a backup, looking for all classes inheriting from db.Model (Google App Engine).
Thanks,
Neal Walters
...
I'm attempting to shorten the memory footprint of 10B sequential integers by referencing them as indexes in a boolean array. In other words, I need to create an array of 10,000,000,000 elements, but that's well into the "Long" range. When I try to reference an array index greater than sys.maxint the array blows up:
x = [False] * 100000...
I have had numerous headaches trying to get the MySQL APIs for Perl and Python working on my 64 bit Macbook Pro (Leopard). I installed the 64 bit version of MySQL, but Googling around now I have the impression that this could be the source of my pain. None of the various blogs and SO answers quite seem to work (for example here on SO)
...
class TestSpeedRetrieval(webapp.RequestHandler):
"""
Test retrieval times of various important records in the BigTable database
"""
def get(self):
commandValidated = True
beginTime = time()
itemList = Subscriber.all().fetch(1000)
for item in itemList:
pass
endTime = time()
self....
Hello, I was wondering if it was possible to share widgets between PyQt and Boost.Python.
I will be embedding a Python interpreter into an application of mine that uses Qt. I would like users of my application to be able to embed their own UI widgets into UI widgets programmed in C++ and exposed via Boost.Python.
Is this possible and ...
I have this datastore model
class Project(db.Model)
projectname = db.StringProperty()
projecturl = db.StringProperty()
class Task(db.Model)
project = db.ReferenceProperty(Project)
taskname= db.StringProperty()
taskdesc = db.StringProperty()
How do I edit the value of taskname ? say I have task1 and i want to change it to task1-project...
The task is to generate a given number of numeric pins of a given length.
Here's the code I came up with for a particular case of numeric pins that don't start with 0:
def generate_pins(length, count):
return random.sample(range(int('1' + '0' * (length - 1)), int('9' * length)), count)
How would you implement it?
EDIT: Pins shoul...
What is the difference between __str__ and __repr__ in Python?
...
I know that __builtin__ sorted() function works on any iterable. But can someone explain this huge (10x) performance difference between anylist.sort() vs sorted(anylist) ? Also, please point out if I am doing anything wrong with way this is measured.
"""
Example Output:
$ python list_sort_timeit.py
Using sort method: 20.0662879944
Us...
I have a cherrypy web server that uses larges amounts of HTML data. Is there anyway in Python to minimize the HTML so that all comments, spaces, ext, are removed?
...
Does iPython work on Mac OS X 10.6.1 Snow Leopard? I'm python noob, how can I install iPython on my Mac? Links? suggestions?
Thanks
...
I work on a large financial pricing application in which some long running calculations. We have identified some functions which can be sped up by the selective application of psyco. My management have requested an assessment of the costs & benefits of adding psyco into our stack.
Given the critical nature of my project, it's not acce...
While Python's standard library has a module for curses, that seems to require a lot of fairly low-level handling.
Is there a simpler way to get started with writing a basic curses UI which includes standard elements like checkboxes, input fields etc.?
I've found urwid, but not sure whether that's the state of the art.
...
My program stores file index in file packed by cPickle. There are non-english filenames.
When I just do this
print f [0]
where f [0] is "\xc2\xe8\xf1\xee\xea\xee\xf1\xed\xfb\xe9 \xe3\xee\xe4" ("Високосный год" in normal view), it prints the string in proper way — in russian.
When the program manually adds the string u'Високосный год'...
Psyco is a specialising compiler for Python. The documentation states
Psyco can and will use large amounts of memory.
What are the main reasons for this memory usage? Is substantial memory overhead a feature of JIT compilers in general?
Edit: Thanks for the answers so far. There are three likely contenders.
Writing multiple spec...
I have a fresh install (started with a wiped drive) of Snow Leopard with the developer tools installed during the Snow Leopard installation. I then installed Python 2.6.2, replacing the Snow Leopard default python 2.6.1. I've tried to install PIL by (1) easy_install (2) pip and (3) downloading source and running "python setup.py build" m...
I'm using PyGreSQL to access my DB. In the use-case I'm currently working on; I am trying to insert a record into a table and return the last rowid... aka the value that the DB created for my ID field:
create table job_runners (
id SERIAL PRIMARY KEY,
hostname varchar(100) not null,
is_available boolean default...
I am trying to send a file to torrage.com from an app in GAE.
the file is stored in memory after being received from a user upload.
I would like to be able to post this file using the API available here:
http://torrage.com/automation.php but i am having some problems undestanding how the body of the post should be encoded, the most i go...