What is the analog for .Net InvalidOperationException in Python?
What is the analog for .Net InvalidOperationException in Python? ...
What is the analog for .Net InvalidOperationException in Python? ...
hi, in python, how can a custom format-specification be added, to a class ? for example, if i write a matrix class, i would like to define a '%M' (or some such) which would then dump the entire contents of the matrix... thanks ...
I'd like to add a --version command line option to my python application that will show the right version depending on the tagged status of the command: If the file comes from a version whose short hex ID was abcdef01 that was tagged TAG, --version should show this: MyApp Version TAG (abcdef01) If the file comes from the tip, --versi...
I'm having trouble copying a row from one table to another using sqlite3 in python (2.6.1 don't ask). I can specify one column, but if I add a second, it gives me an error. import sqlite3 conn = sqlite3.connect("database.db") cursor = conn.cursor() #this works: cursor.execute("insert into table2 (name) select (name) from table1") curs...
I create the following class: class Image(object): def __init__(self, extension, data, urls=None, user_data=None): self._extension = extension self._data = data self._urls = urls self._user_data = user_data self._hex_digest = hashlib.sha1(self._data).hexDigest() Images should be equal when a...
Hi guys, I'm writing a Python open-source app. My app uses some open source Python libraries. These libraries in turn use other open-source libraries. I intend to release my code at Sourceforge or Google Code but do I need to include the sources of the other libraries? Is this a good practice? ...or should I simply write this informati...
I have a simple 2 node cluster (master on one, workers on both). I tried using: python disco/util/distrfiles.py bigtxt /etc/nodes > bigtxt.chunks To distribute the files (which worked ok). I expected this to mean that the processes would spawn and only operate on local data, but it seems that they are trying to access data on the oth...
I am having issues running this: link-mbp:codeswarm-0.1 benb$ python convert_logs/convert_logs.py -perforce-path Traceback (most recent call last): File “convert_logs/convert_logs.py”, line 408, in main() File “convert_logs/convert_logs.py”, line 350, in main files = run_marshal(’p4 -G describe -s “‘ + changelist['change'] + ‘”‘) KeyErr...
I had to reinstall my OS, and so, I reinstalled django 1.1. Since reinstalling, when I run tests in my app, I get several failures from django.contrib.auth. Logs: http://dpaste.com/178153/ I asked on #django, and no one is too sure what the cause of the errors are. Some of my own code fails its tests, because it's not fully written yet...
What chances do I have to instantiate, keep and serialize/deserialize to/from binary data Python classes reflecting this pattern (adopted from RFC 2246 [TLS]): enum { apple, orange } VariantTag; struct { uint16 number; opaque string<0..10>; /* variable length */ } V1; struct { uint32 number; opaqu...
I know PyCharm is young IDE but id like to know if you guys have found some candy while using it. I know from experience that JetBrains IDE's are filled with candy and can't wait to find it all. Please list your tips, perhaps something you did not first expected to be there. ...
I am using jabber bot written in python to log some MUC talks. Sometimes it drops on some network or XMPP problems. In this case I have to start it again by myself. The goal is to make it "self-respawning". I have some variants about how to do it. Bot is one process. Another process monitors its activity and starts it if bot died. Mai...
I'm looking for a solution to the following: Given today's date, figure out what month was before. So 2 should return for today, since it is currently March, the third month of the year. 12 should return for January. Then based on that, I need to be able to iterate through a directory and find all files that were created that month. ...
hi; i need grab to internet explorer address bar. how to get address bar url for python ? (i need second part other browsers grabbing address bar but internet explorer is urgently). Thanks. ...
Is there a quick way in Python to replace strings by starting from the end? For example: >>> def rreplace(old, new, occurence) >>> ... # Code to replace the last occurences of old by new >>> '<div><div>Hello</div></div>'.rreplace('</div>','</bad>',1) >>> '<div><div>Hello</div></bad>' ...
I'm writing a Python wrapper for a C++ library, and I'm getting a really weird when trying to set a struct's field in C. If I have a struct like this: struct Thing { PyOBJECT_HEAD unsigned int val; }; And have two functions like this: static PyObject* Thing_GetBit(Thing* self, PyObject* args) { unsigned int mask; if...
Is there a way to login my hotmail account and send mails with a Python program? ...
In an interactive session like the following one: >>> f=open('test.txt','w') >>> f <open file 'test.txt', mode 'w' at 0x6e610> what does 0x6e610 represents and what could i do with that hexadecimal number in python? ...
This is pretty strange (admitedly, this is my first attempt with python / sqlite), but I can seem to get all of the rows if I do a fetchAll(), but other than that - no matter what I try, always ends up in the db only returning the first row - the second iteration stops because a null is returned. Wondering if there is something wrong wit...
Ok, so I've read both PEP 8 and PEP 257, and I've written lots of docstrings for functions and classes, but I'm a little unsure about what should go in a module docstring. I figured, at a minimum, it should document the functions and classes that the module exports, but I've also seen a few modules that list author names, copyright info...