We're using SQLAlchemy declarative base and I have a method that I want isolate the transaction level for. To explain, there are two processes concurrently writing to the database and I must have them execute their logic in a transaction. The default transaction isolation level is READ COMMITTED, but I need to be able to execute a piece ...
I have a huge set of data of tables in Open Office 3.0 document format.
Table 1:
(x range)|(x1,y1) |(x2,y2)|(x3,x3)|(x4,y4)
(-20,90) |(-20,0) |(-5,1) |(5,1) |(10,0)
...
Like wise i have n number of tables.All of these tables are fuzzy set membership functions.In simple terms they are computational model's according to...
I have list like:
['name','country_id', 'price','rate','discount', 'qty']
and a string expression like
exp = 'qty * price - discount + 100'
I want to convert this expression into
exp = 'obj.qty * obj.price - obj.discount + 100'
as I wanna eval this expression like eval(exp or False, dict(obj=my_obj))
my question is what would b...
i need to load the third column of this text file as a hex string
http://www.netmite.com/android/mydroid/1.6/external/skia/emoji/gmojiraw.txt
>>> open('gmojiraw.txt').read().split('\n')[0].split('\t')[2]
'\\xF3\\xBE\\x80\\x80'
how do i open the file so that i can get the third column as hex string:
'\xF3\xBE\x80\x80'
i also tried ...
I can't seem to find a good resource on this.. I am trying to do a simple re.place
I want to replace the part where its (.*?), but can't figure out the syntax on how to do this.. I know how to do it in PHP, so I've been messing around with what I think it could be based on that (which is why it has the $1 but I know that isn't correct i...
http://docs.python.org/library/imaplib.html states that:
exception IMAP4.error
Exception raised on any errors. The reason for the exception is passed to the constructor as a string.
What does "exception is passed to the constructor as a string" mean? What would the code look like that can print the reason.
...
Hi everyone,
I'm parsing strings that could have any number of quoted strings inside them (I'm parsing code, and trying to avoid PLY). I want to find out if a substring is quoted, and I have the substrings index. My initial thought was to use re to find all the matches and then figure out the range of indexes they represent.
It seems...
I am using the gdata-python library to perform a number of operations via the Google Docs API. This library uses version 2 of the protocol, which does not support changing the ownership of a document.
Has anyone managed to find a successful workaround which lets them change the owner of a document using the version 2 API?
One idea I th...
Hope my question has not asked before. I have two graphs, which nodes are the same in both of them but edges are different. I want to draw both of graphs in one plot. Which means I have the same nodes, but with two different edge colours. But it gives me two different graphs. How could I have them in one graph but with different edge co...
In Scala I could define an abstract class and implement it with an object:
abstrac class Base {
def doSomething(x: Int): Int
}
object MySingletonAndLiteralObject extends Base {
override def doSomething(x: Int) = x*x
}
My concrete example in Python:
class Book(Resource):
path = "/book/{id}"
def get(request):
...
I currently have a deep object, and it is all unicode (sadly).
I am to a point where a variable is either going to be a dict, or a bool. In this case, I do
if type( my_variable ) is BooleanType:
But this is not triggered because the type is actually Unicode for all values.
How do I convert this unicode object to a normal object so I ...
I have a directory with a set of YYYY-MM-DD-dated files in as so:
pictures/
2010-08-14.png
2010-08-17.png
2010-08-18.png
How can I use Python GStreamer to turn these files into a video? The filenames must remain the same.
I have a program that can turn incrementally numbered PNGs into a video, I just need to adapt it to u...
How can I launch a new Finder window (or Explorer on Win) from python in a specific folder. The behaviour I'm looking for is the equivalent of "Show in finder" link in a tracks context menu in iTunes or most other programs come to think of it.
What I have currently is a UI built with PyQt and I'd like to add a menu option like "show log...
Hello,
I'm working on a Gui and I'd like to know if it is possible to make the menu property of a window a separate class on my script for a clearer and more enhancement prone code.
my code currently is :
class Application(Frame):
""" main window application """
def __init__(self, boss = None):
(...)
self.menu = Menu(self)...
(Couldn't upload the picture showing the integral as I'm a new user.)
...
hi,
I've searched but theres no libxml2 binaries for py2.7.
I have also tried running setup.py for version py2.6.9 but it gave me the error
failed to find headers for libxml2: update includes_dir
Does anyone have a solution?
...
I wrote a temperature logger Python script and entered it as a scheduled task in Windows XP. It has the following command line:
C:\Python26\pythonw.exe "C:\path\to\templogger.py"
It writes data to a file in local public folder (e.g. fully accessible by all who login locally).
So far, I was able to achieve this objective:
1. Get the ...
I'm using my own resolver and would like to use urllib2 to just connect to the IP (no resolving in urllib2) and I would like set the HTTP Host-header myself. But urllib2 is just ignoring my Host-header:
txheaders = { 'User-Agent': UA, "Host: ": nohttp_url }
robots = urllib2.Request("http://" + ip + "/robots.txt", txdata, txheaders)
...
I'm parsing a non-compliant xml file (Sphinx's[1] xmlpipe2 format) and would like lxml parser to ignore the fact that there are unresolved namespace prefixes.
An example of the Sphinx XML:
<sphinx:schema>
<sphinx:field name="subject"/>
<sphinx:field name="content"/>
<sphinx:attr name="published" type="timestamp"/...
I'm having a problem with the datastore trying to replicate a left join to find items from model a that don't have a matching relation in model b:
class Page(db.Model):
url = db.StringProperty(required=True)
class Item(db.Model):
page = db.ReferenceProperty(Page, required=True)
name = db.StringProperty(required=True)
I wa...