"The application failed to initialize properly ... Click on OK,to terminate the application." is the message from the error pop-up. What is the way to catch these errors in Python code?
...
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.
Anyways, could anyone elaborate on this? What exactly makes development in ...
I need to parse a log in the following format:
===== Item 5483/14800 =====
This is the item title
Info: some note
===== Item 5483/14800 (Update 1/3) =====
This is the item title
Info: some other note
===== Item 5483/14800 (Update 2/3) =====
This is the item title
Info: some more notes
===== Item 5483/14800 (Update 3/3) =====
This is th...
I am trying to compare 2 text files and output the first string in the comparison file that does not match but am having difficulty since I am very new to python. Can anybody please give me a sample way to use this module.
When I try something like:
result = difflib.SequenceMatcher(None, testFile, comparisonFile)
I get an error sa...
Hi,
I'm trying to figure out how to redirect output from some FORTRAN code for which I've generated a Python interface by using F2PY. I've tried:
from fortran_code import fortran_function
stdout_holder = sys.stdout
stderr_holder = sys.stderr
sys.stdout = file("/dev/null","w")
fortran_function()
sys.stdout.close()
sys.stderr.close()
sys...
Hello,
I am using pySerial to read in data from an attached device. I want to calculate the checksum of each received packet. The packet is read in as a char array, with the actual checksum being the very last byte, at the end of the packet. To calculate the checksum, I would normally sum over the packet payload, and then compare it to ...
Hallo, I looked at the various loose-coupling questions around here but couldn't pin down something similar to my question, so apologies if it's already been asked.
Basically I have a homegrown, very simplistic routing library that consists of Segments, Hubs, and Stubs. Hubs and Stubs inherit Segments, and represent directories or primi...
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls i...
Does anyone know how to set up auto completion to work nicely with python, django, and vim?
I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I ...
I create little SimpleXMLRPCServer for check ip of client.
I try this:
Server
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
server = SimpleXMLRPCServer(("localhost", 8000))
def MyIp():
return "Your ip is: %s" % server.socket.getpeername()
server.register_function(MyIp)
server.serve_forever()
Client
impo...
Hi All,
Here's my problem: I'm trying to parse a big text file (about 15,000 kb) and write it to a mysql database. I'm using python 2.6, and the script parses about half the file and adds it to the database before freezing up. Sometimes it displays the text: MemoryError. Other times it simply freezes. I figured I could avoid this pr...
I'm configuring autocompletion for python and django in vim. One of the problems is that I need to set an environment variable DJANGO_SETTINGS_MODULE=myapp.settings. The django tutorial states that
The value of DJANGO_SETTINGS_MODULE
should be in Python path syntax, e.g.
mysite.settings. Note that the
settings module should ...
Is there a way to get all objects with a date less than a month ago in django.
Something like:
items = Item.objects.filter(less than a month old).order_by(...)
...
I tried using the ssl module in Python 2.6 but I was told that it wasn't available. After installing OpenSSL, I recompiled 2.6 but the problem persists.
Any suggestions?
...
I have a Pythonic HTTP server that is supposed to determine client's IP. How do I do that in Python? Is there any way to get the request headers and extract it from there?
PS: I'm using WebPy.
...
Hi guys,
Say I have an array of tuples which look like that:
[('url#id1', 'url#predicate1', 'value1'),
('url#id1', 'url#predicate2', 'value2'),
('url#id1', 'url#predicate3', 'value3'),
('url#id2', 'url#predicate1', 'value4'),
('url#id2', 'url#predicate2', 'value5')]
I would like be able to return a nice 2D array to be able to display...
Hi,
I would like to get the dimensions (coordinates) for all the HTML elements of a webpage as they are rendered by a browser, that is the positions they are rendered at. For example, (top-left,top-right,bottom-left,bottom-right)
Could not find this in lxml. So, is there any library in Python that does this? I had also looked at Mechan...
Is there a difference between dir(…) and vars(…).keys() in Python?
(I hope there is a difference, because otherwise this would break the "one way to do it" principle... :)
...
Hey, I'm having some trouble using the QuickBase API from Python. From the QuickBase guide, there are two methods of hitting the API: POST and GET. I can handle the GET calls, but some API methods require XML to be sent over POST. The link to the documentation is here: http://member.developer.intuit.com/MyIDN/technical_resources/quic...
Hello,
I am looking at trying to create a python server, which allows me to run root commands on a Centos Server remotely, I would also like the server to be able to respond with the result's of the command.
I have found another question on here which has a basic python server, however it throws a error, the code is:
#!/usr/bin/python...