ANN: SQLObject 0.6 (and 0.5.3)

I've made a long-overdue release of SQLObject 0.6, and a final bug-fix
release for the 0.5 series.

What is SQLObject

SQLObject is an object-relational mapper. Your database tables are
described as classes, and rows are instances of those classes.
SQLObject is meant to be easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and
Firebird. It also has newly added support for Sybase and MaxDB (also
known as SAPDB).

Where is SQLObject


Mailing list:



News and changes:

What's New

In 0.5.3: some small bug fixes, and an important fix when iterating over
selects in threaded environments.

In 0.6:

The "SQLObject" module has been renamed "sqlobject".

To fetch objects from the database, use MyClass.get(id) (instead of
MyClass(id)). To create/insert objects, use MyClass(col=value, ...)
(instead of, ...)).

Better support for constraints.

Connections given using URLs, like 'mysql://userass@localhost/dbname'

Optional lazy updates -- SQL UPDATE executed only on demand.

For a more complete list, please see the news:

Ian Bicking / /

Posted On: Monday 5th of November 2012 04:04:45 AM Total Views:  493
View Complete with Replies

Related Messages:

Re: annoying dictionary problem, non-existing keys   (451 Views)
bvidinli writes: > i use dictionaries to hold some config data, > such as: > > conf={'key1':'value1','key2':'value2'} > and so on... > > when i try to process conf, i have to code every time like: > if conf.has_key('key1'): > if conf['key1']'': > other commands.... > > > this is very annoying. Especially when you don't have to do this. > in php, i was able to code only like: > if conf['key1']=='someth' > > in python, this fails, because, if key1 does not exists, it raises > an exception. > > MY question: is there a way to directly get value of an > array/tuple/dict item by key, as in php above, even if key may not > exist, i should not check if key exist, i should only use it, if it > does not exist, it may return only empty, just as in php.... At the interactive prompt, type 'help(dict)' and read carefully about the different methods provided by dictionary objects (one called 'get' may be of particular interest to you). HTH -- Arnaud
Re: Cannot build Python 2.4 SRPM on x64 platform   (329 Views)
"Michael Wieher" wrote in message > Sorry I don't have much of a better idea, but if I had this kind of > problem > with an RPM, I'd just grab the tarball and start hacking away at > ./configure > pre-requirements, trying to use --options to trim it down to the bare > minimal and see if I can get it to load up.
Cannot catch _mysql_exceptions.OperationalError   (336 Views)
In our database code (we are using django v0.96) we wanted to catch and handle MySQL OperationalErrors. We use both the Django models and database connections. However, even though we confirmed that a _mysql_exceptions.OperationalError are raised (particularly 1213 deadlock), we cannot catch them with try/except. Here's the code that did not work: import _mysql_exceptions from _mysql_exceptions import OperationalError try: database_code() except (_mysql_exceptions.OperationalError, OperationalError), e: error_handling() Originally, we just had one import, but tried both to ensure that was not the problem. In debugging, we confirmed that both type(e) and e.__class_ were . The only work-around we found was: try: database_code() except Exception, e: if e.__class__.__name__.find('OperationalError') != -1: error_handling() else: raise This seems silly. If we used any other exception, the except clause seems to work correctly. Is there a problem with _mysql_exceptions.OperationalError Is there a better work-around
Re: Cannot import opj   (458 Views)
En Thu, 08 May 2008 21:28:25 -0300, David Anderson escribi: > I'm trying to import the opj module What's the opj module > Trying like this: > from Main import opj > It says it doesn't exists And why do you think it should exist > And like this: > import os.path.join as opj > Raises error. > What should I do os is a module, os.path is a module too, which contains a function named join. You can't import it that way. Try: a) from os.path import join as opj b) import os.path opj = os.path.join You import modules (or packages) using "import xxx", or you import individual attributes from those modules or packages using "from xxx import yyy" What are you really trying to do -- Gabriel Genellina
Re: annoying dictionary problem, non-existing keys   (327 Views)
bvidinli wrote: > I posted to so many lists because, > > this issue is related to all lists, No, it isn't, as you would have discovered had you bothered to read the purpose of each list. For example, python-help and python-dev are mutually exclusive. > this is an idea for python, It isn't an idea for Python at all. It's you, telling the world that you haven't really used Python much and haven't read the manuals but would nevertheless like us to consider your ideas for improving the language. > this is related to development of python... > No it isn't. Python already has the feature you requested. > why are you so much defensive > Terry wasn't being defensive, he was protecting you form the abue you would receive of you kept posting to the wrong list! > i think ideas all important for development of python, software.... > i am sory anyway.... hope will be helpful. > We hope you will be helpful too. For now it would probably be best to start by posting your questions on the regular comp.lang.python group, which is generally suitable for beginners who know something about programming. If you are new to programming as well then the python-tutor list would be more useful. Ask with a little humility (the people who answer questions here are doing it out of the goodness of their hearts, remember) and soon you will be able to pass their assistance on, returning the favor they did for you. Welcome to the Python community. regards Steve > 2008/4/24, Terry Reedy : >> Python-dev is for discussion of development of future Python. Use >> python-list / comp.lang.python / gmane.comp.python.general for usage >> questions. -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC
Tabnanny errors when Migrating Python 2.4 code to 2.5   (386 Views)
When Python 2.5 first came out, I eagerly downloaded it and immediately had issues with getting it to run my 2.4 code. So I just stuck to 2.4. However, I decided this week that I really should try to get 2.5 to work. Does anyone know why code that works perfectly for months in a 2.4 environment throws indentation errors in 2.5 And why does 2.5 default to indenting 8 characters instead of 4 in IDLE That's just weird. When I did a select all and did a Tabify region, it indented everything 8 characters then too. I haven't changed the configuration at all. Any ideas
Cannot understand error message   (375 Views)
The following code produces an error message (using Idle with Py 2.4 and 2.5). "There's an error in your program: EOL while scanning single-quoted string". It comes just after "s = ''" (put there to try and isolate the broken string). It would be good if the error message pointed me to the start of said single quoted string. The colouring in IDLE does not indicate a bad string. Puzzled. Bill # # The traceback module is used to provide a stack trace to # show the user where the error occured. See Error(). # import traceback # # The math module is used to convert numbers between the Python real format # and the Keil real format. See KeilToFloatingPoint() and FloatingToKeil(). # import math LOAD_LIT = 1 LOAD_REG = 1 STORE_REG = 1 ADD_LIT_FP = 2 + 8 ADD_LIT_INT = 2 + 16 ADD_REG_FP = 2 + 32 ADD_REG_INT = 9 SUB_LIT_FP = 11 SUB_LIT_INT = 12 SUB_REG_FP = 13 SUB_REG_INT =14 MUL_LIT_FP = 11 MUL_LIT_INT = 12 MUL_REG_FP = 13 MUL_REG_INT =14 DIV_LIT_FP = 11 DIV_LIT_INT = 12 DIV_REG_FP = 13 DIV_REG_INT =14 AND_LIT_INT = 12 AND_REG_INT =14 OR_LIT_INT = 12 OR_REG_INT =14 NEGATE_FP = 11 NEGATE_INT = 12 ABSOLUTE_FP = 13 ABSOLUTE_INT = 14 INVERT_INT = 15 JUMP_OPCODE = 15 JLT_OPCODE = 15 JGT_OPCODE = 15 JLE_OPCODE = 15 JGE_OPCODE = 15 JEQ_OPCODE = 15 JNE_OPCODE = 15 BinaryOps={ "LOAD":{float:{"L":LOAD_LIT,"R":LOAD_REG},int:{"L":LOAD_LIT,"R":LOAD_REG}}, "STORE":{float:{"R":STORE_REG},int:{"R":STORE_REG}}, "ADD":{float:{"L":ADD_LIT_FP,"R":ADD_REG_FP},int:{"L":ADD_LIT_INT,"R":ADD_REG_INT}}, "SUB":{float:{"L":SUB_LIT_FP,"R":SUB_REG_FP},int:{"L":SUB_LIT_INT,"R":SUB_REG_INT}}, "MUL":{float:{"L":MUL_LIT_FP,"R":MUL_REG_FP},int:{"L":MUL_LIT_INT,"R":MUL_REG_INT}}, "DIV":{float:{"L"IV_LIT_FP,"R"IV_REG_FP},int:{"L"IV_LIT_INT,"R"IV_REG_INT}}, "AND":{int:{"L":AND_LIT_INT,"R":AND_REG_INT}}, "OR":{int:{"L":OR_LIT_INT,"R":OR_REG_INT}} } UnaryOps={ "NEGATE":{float:NEGATE_FP, int:NEGATE_INT}, "ABSOLUTE":{float:ABSOLUTE_FP, int:ABSOLUTE_INT}, "INVERT":{int:INVERT_INT} } JumpOps={ "JUMP":JUMP_OPCODE, "JLT":JLT_OPCODE, "JGT":JGT_OPCODE, "JLE":JLE_OPCODE, "JGE":JGE_OPCODE, "JEQ":JEQ_OPCODE, "JNE":JNE_OPCODE } def IsOpCode(s): if ( s in BinaryOps ): return True; if ( s in UnaryOps ): return True; if ( s in JumpOps ): return True; return False class Register: """ This class provides us with a register (say) 0..32 In addtion to a number, a register can be given a name. It allows LOAD(arg) and other opcodes to distinguish between references to a register and a literal value. """ def __init__(self,Id,Name=None): self.Number = Id if ( Name == None): self.Name = "R%d" % Id else: self.Name = Name def RegisterNumber(self): return self.Number def RegisterName(self): return self.Name R0=Register(0) R1=Register(1) R2=Register(2) Now=Register(2,"Now") def IsRegister(arg): return hasattr( arg, "RegisterNumber") assert not IsRegister(0) assert not IsRegister(1.2) assert IsRegister(R1) assert IsRegister(Now) # # ErrorCount is global as it is shared by all slaves. # ErrorCount = 0 def Error(Message): """ work back through the traceback until you find a function whose name is in one of the opcode dictionaries and trace back from there. This will keep internal implemenataion functions private but still allow the suer to define functions that generate code. """ global ErrorCount ErrorCount += 1 """ [ ('', 1, '', None), ('C:\\Python24\\lib\\idlelib\\', 90, 'main', 'ret = method(*args, **kwargs)'), ('C:\\Python24\\lib\\idlelib\\', 283, 'runcode', 'exec code in self.locals'), ('H:\\Husky Experiments\\Viper1\\', 434, '', 'STORE(1)'), ('H:\\Husky Experiments\\Viper1\\', 147, 'STORE', 'self.BINOP("STORE",Arg,Msg)'), ('H:\\Husky Experiments\\Viper1\\', 198, 'BINOP', 'return Error("Cannot perform %s on %s" % (Op,Arg))'), ('H:\\Husky Experiments\\Viper1\\', 106, 'Error', 'tb = traceback.extract_stack()') ] """ tb = traceback.extract_stack() BeforePrinting = True IsPrinting = False for i in range(len(tb)-1,0,-1): frame = tb[i] if ( BeforePrinting ): # Looking to start if IsOpCode(frame[2]): # start printing IsPrinting = True BeforePrinting = False print "John: %s\nTrace back follows:" % Message elif ( IsPrinting ): print '\tFile "%s", line %u, %s' % (frame[0], frame[1], frame[3]) # Stop when we find the curious function "" if (frame[2] == ""): break if BeforePrinting: print "John: %s (no trace back)" % Message class Slave: "This is a slave class" Listing = "" Number = 0 Mode = 0; # Will be int or float when defined def __init__(self,Id): self.Number = Id self.Line = 0 # # The listing, built as we go along # self.Listing = "" self.Mode = None def SetMode(self, arg): self.Mode = arg def LOAD(self,Arg,Msg=""): self.BINOP("LOAD",Arg,Msg) def STORE(self,Arg,Msg=""): self.BINOP("STORE",Arg,Msg) def ADD(self,Arg,Msg=""): self.BINOP("ADD",Arg,Msg) def SUB(self,Arg,Msg=""): self.BINOP("SUB",Arg,Msg) def MUL(self,Arg,Msg=""): self.BINOP("MUL",Arg,Msg) def DIV(self,Arg,Msg=""): self.BINOP("DIV",Arg,Msg) def AND(self,Arg,Msg=""): self.BINOP("AND",Arg,Msg) def OR(self,Arg,Msg=""): selfBINOPOP("OR",Arg,Msg) def NEGATE(self,Msg=""): self.UNOP("NEGATE",Msg) def ABSOLUTE(self,Msg=""): self.UNOP("ABSOLUTE",Msg) def INVERT(self,Msg=""): self.UNOP("INVERT",Msg) def JUMP(self,Arg,Msg=""): self.JUMPOP("JUMP",Arg,Msg) def JLT(self,Arg,Msg=""): self.JUMPOP("JLT",Arg,Msg) def JGT(self,Arg,Msg=""): self.JUMPOP("JGT",Arg,Msg) def JLE(self,Arg,Msg=""): self.JUMPOP("JLE",Arg,Msg) def JGE(self,Arg,Msg=""): self.JUMPOP("JGE",Arg,Msg) def JEQ(self,Arg,Msg=""): self.JUMPOP("JEQ",Arg,Msg) def JNE(self,Arg,Msg=""): self.JUMPOP("JNE",Arg,Msg) def BINOP(self,Op,Arg,Msg): entry = BinaryOps.get(Op) assert entry != None, "Who gave me %s to look up" % op entry = entry.get(self.Mode) if entry == None : return Error("Cannot perform %s on %s, mode=%s" % ( Op,Arg,self.Mode)) if ( IsRegister(Arg) ): ot = entry.get("R") # Register if ot == None: return Error("Cannot perform %s on %s" % (Op,Arg)) self.Listing += "%x \t \t%s\t%s\t# %s\n" % ( len(self.Memory), Op,Arg.RegisterName(), Msg) self.Memory.append(ot) self.Memory.append(Arg.RegisterNumber()) else: ot = entry.get("L") # Literal if ot == None: return Error("Cannot perform %s on %s" % (Op,Arg)) self.Listing += "%x \t \t%s\t%s\t# %s\n" % ( len(self.Memory), Op, Arg, Msg) self.Memory.append(ot) cArg = self.Mode(Arg) if self.Mode == int: try: iArg = int(Arg) except TypeError: return Error("Argument %r is not an integer" % Arg) except: return Error("Unexpected error:", sys.exc_info()[0]) if ( iArg != Arg ): return Error("Argument %r is not an integer" % Arg) self.Memory.append((iArg >> 24) & 0xFF) self.Memory.append((iArg >> 16) & 0xFF) self.Memory.append((iArg >> 8) & 0xFF) self.Memory.append((iArg >> 0) & 0xFF) elif self.Mode == float: try: fArg = float(Arg) except TypeError: return Error("Argument %r is not a float" % Arg) except: return Error("Unexpected error:", sys.exc_info()[0]) if ( fArg != Arg ): return Error("Argument %r is not a float" % Arg) FourBytes = FloatingToKeil(fArg) self.Memory.append(FourBytes[0]) self.Memory.append(FourBytes[1]) self.Memory.append(FourBytes[2]) self.Memory.append(FourBytes[3]) else: return Error("No or bad mode (%r)set for slave %u" % ( self.Mode,self.SlaveNumber)) def JUMPOP(self,Op,Name,Msg): entry = JumpOps.get(Op) assert entry != None, "Who gave me %s to look up" % op """ Generate code for a jump to the given target May enter target into the table. """ self.Listing += "%x \t \t%s\t%s\t# %s\n" % ( len(self.Memory),Op,Name, Msg) self.Memory.append(entry) self.AddReference(Name,len(self.Memory)) # for patching up later self.Memory.append(0) # Space for destination of jump # # The memory image of this Slave. # Memory = [] def ListProgram(self): """Generate a user friendly listing of the program for this Slave. """" s = '' print "%s" % self.Number print "%s\n" % ("#" * 64) print "%s" % self.Listing pass def EmitProgram(self): """Emit a C code data structure of the program for this Slave. """ s=\ "%s\n/* C data structure for slave %d */\n"\ "struct\n"\ "\t{\n"\ "\tunsigned SlaveId;\n"\ "\tunsigned nBytes;\n"\ "\tunsigned char[%d];\n"\ "\t} Slave%d=\n"\ "\t{%u,%u\n"\ "\t{\n\t"\ % ('#'*64, self.Number, len(self.Memory), self.Number, self.Number, len(self.Memory)) for i in range(0,len(self.Memory)): if (i>0) : s+= ", " s += "0x%x" % (self.Memory[i]) if ( (i % 16) == 15 ): s += '\n\t' s+="\n\t}\n\t};\n" print s; # # Dictionary of Labels # Maps Name onto (Set of Locations, List of references)) # Users define a label using Label(Name) # Users reference a label using Jump(Name) # LabelTable = {} def AddReference(self,Name,Reference): """ Add a reference to the given Name. Name may not yet be defined """ Entry = self.LabelTable.get(Name) if ( Entry == None ): self.LabelTable[Name] = [ [] , [Reference] ] else: Entry[1].append(Reference) def AddDefinition(self,Name,Location): """ Add a definition to the given Name. Name may not yet be defined. If it is defined, it may not be given a different Location. """ Entry = self.LabelTable.get(Name) if ( Entry == None ): # Add location to a new name self.LabelTable[Name] = [ [Location] , [] ] elif len(Entry[0]) == 0: # Provide an initial location for a known name Entry[0].append(Location) elif Entry[0].count(Location) == 1: # The same location, harmless but odd pass else: # This is an additional definition but that does not matter # unless it is used and we find that out when we call FixUpLabels() # at the end. Entry[0].append(Location) def Label(self, Name, Msg=""): """ Lays down a label for the user. """ self.AddDefinition(Name,len(self.Memory)) self.Listing += "%x \t%s: \t \t \t# %s\n" % (len(self.Memory), Name, Msg) def EmitLabelTable(self): print "%s\nSymbol table for Slave %u" % ('#' * 64, self.Number) for Name in self.LabelTable.keys(): s = "Name=%s" % Name entry = self.LabelTable[Name] if ( len(entry[0])==1 and len(entry[1]) == 0): s += ", is not referenced" if ( len(entry[0])==0 and len(entry[1]) > 0): s += ", is not defined" if ( len(entry[0])>1 and len(entry[1]) > 0): s += ", is multiply-defined" if ( len(entry[0]) > 0): s += ", Location:" for i in entry[0]: s += " %x" % i if ( len(entry[1]) > 0 ): s += ", references:" for i in range(0,len(entry[1])): s += " %x" % entry[1][i] print s def FixUpLabels(self): print "%s\nFixing labels for Slave %u" % ('#' * 64, self.Number) for Name in self.LabelTable.keys(): entry = self.LabelTable[Name] if ( len(entry[0])==1 and len(entry[1]) == 0): print "Warning: %s is not referenced" % Name elif ( len(entry[0])==0 and len(entry[1]) > 0): Error("%s is not defined" % Name) elif ( len(entry[0])>1 and len(entry[1]) > 0): Error("%s is multiply-defined" % Name) else: for i in range(0,len(entry[1])): self.Memory[entry[1][i]] = entry[0][0] # # Construct a vector of Slaves # S=[(Slave(i)) for i in range(6)] def SetSlave(New): """ Make global functions generate code for a specified slave. """ # # This sets the mode for the assembler and applies in the order of # assembly, not in the execution order. The mode is embedded in the opcode. # global SetMode SetMode = S[New].SetMode # # Labels are local to a slave. # global Label Label = S[New].Label; global LOAD, STORE, ADD, SUB, MUL, DIV, AND, OR global NEGATE, ABSOLUTE, INVERT global JUMP, JLT, JGT, JLE, JGE, JEQ, JNE LOAD = S[New].LOAD JUMP = S[New].JUMP LOAD = S[New].LOAD STORE = S[New].STORE ADD = S[New].ADD SUB = S[New].SUB MUL = S[New].MUL DIV = S[New].DIV AND = S[New].AND OR = S[New].OR NEGATE = S[New].NEGATE ABSOLUTE = S[New].ABSOLUTE INVERT = S[New].INVERT JUMP = S[New].JUMP JLT = S[New].JLT JGT = S[New].JGT JLE = S[New].JLE JGE = S[New].JGE JEQ = S[New].JEQ JNE = S[New].JNE print "hi" SetSlave(1) SetMode(int) LOAD(4,"Into S1 hopefully") Label("Loop") LOAD(R1,"Comment") JUMP("Loop") LOAD(Now) JUMP("Loop") STORE(1) Label("Loop") class TemporaryLabelClass: DefaultBaseName = "TL_" Instances = {DefaultBaseName:0} def __init__(self, BaseName=None): de = self.Instances.get(BaseName) if de == None: self.Instances[BaseName] = 0 # new temporary BaseName else: self.Instances[BaseName] += 1 # using an existing BaseName again self.BaseName = BaseName; def Instance(self): return self.Instances[self.BaseName] def TemporaryLabel(BaseName=None): t = TemporaryLabelClass(BaseName) if ( BaseName == None ): BaseName = t.DefaultBaseName elif ( BaseName == t.DefaultBaseName): return Error("Do not call TemporaryLabel(%s)" % t.DefaultBaseName) return "%s%u" % (BaseName,t.Instance()) a = TemporaryLabel() b = TemporaryLabel("MY") c = TemporaryLabel() d = TemporaryLabel("MY") e = TemporaryLabel() f = TemporaryLabel("TL_") del a, b, c, d, e, f def BusyIdleLoop(Time, Register): label = TemporaryLabel() LOAD(Now) ADD(Time) STORE(Register) Label(label) LOAD(Now) SUB(Register) JLT(label) BusyIdleLoop(5000,R0) S[1].FixUpLabels() S[1].EmitProgram() S[1].EmitLabelTable() S[1].ListProgram() def KeilToFloatingPoint(Bytes): #print Bytes temp = ((((((Bytes[0]= 0 ): if ( Exponent == 0 ): return (0,0,0,0) S = 0 else: S = 1 Mantissa = -Mantissa Mantissa *= (1 24 ): # Renormalise Mantissa >>= 1 Exponent += 1 assert ( (Mantissa >> 24) == 0) Mantissa -= (1 23) == 0 ) Exponent += 127 if ( Exponent < 0 ): # Number is too small to represent; call it zero FourBytes = 0,0,0,0 temp = KeilToFloatingPoint(FourBytes) print "Truncating %r to %r" % (arg, temp) elif ( Exponent > 0xFF): # Number is too big to represent; make the maximum with the right sign FourBytes = (S8),0xFF&(temp)) temp = KeilToFloatingPoint(FourBytes) return FourBytes FloatingToKeil(-12.5) FloatingToKeil(-1e-200) ## should become zero FloatingToKeil(-1e+200) ## should saturate FloatingToKeil(math.ldexp((1
PyQt, Cannot send events to objects owned by a different thread?   (329 Views)
hallo, i try to adress an qt object self.statusbar.showMessage("rtt %s...." % (n.rtt)) in an callback function, comming from a shared lib importet by ctypes, on osx this works wonderfull when i run the same code on linux (ubuntu gutsy), i get this core dump, ok, i understand that the problem is, that i cant speak to the qt thread, but why does it work on osx shall i recompile python pyqt or sip without threads could somebody give me a hint what to do best how can i call a qt object in an c-lib callback thanks for any help, alex ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 82c31e8. Receiver 'MainWindow' (of type 'MainWindow') was created in thread 81f5060", file kernel/qcoreapplication.cpp, line 269 Aborted (core dumped)
[announce] WARPY, Nov. 29, Warsaw, Poland   (354 Views)
I'm pleased to announce the first WARsaw PYthoneers meeting which will be held Nov. 29 at 7 p.m. on Politechnika Warszawska, 15/19 Nowowiejska st., Warsaw, Poland. More information (in Polish) can be found at and in an announcement made on pl.comp.lang.python. See you there! -- Jarek Zgoda Skype: jzgoda | GTalk: | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters)
xmpfilter-a-like for python (code annotation)   (528 Views) looks cool , anything like this for python any reason that we culd not do simmilar
lxml + mod_python: cannot unmarshal code objects in restricted execution mode   (352 Views)
Dmitri Fedoruk wrote: > def extApplyXslt(xslt, data, logger ): > try: > strXslt = urllib2.urlopen(xslt).read() > # i have to read the xslt url to the python string > except urllib2.HTTPError, e: > ....... > except urllib2.URLError, e: > ............. > try: > xslt_parser = etree.XMLParser() > xslt_parser.resolvers.add( PrefixResolver("XSLT") ) > > # and now I have to use the string; a more elegant solution, > anyone Sure, lxml.etree can parse from file-like objects. Just hand in the result of urlopen(). Apart from that, I saw that you found your way to the lxml mailing list, I'll respond over there. Stefan , On Sep 14, 3:04 am, Graham Dumpleton wrote: > Try forcing mod_python to run your code in the first interpreter > instance created by Python. > PythonInterpreter main_interpreter Thank you very much, that solved the problem! A more detailed discussion can also be found in the lxml-dev mailing list ( ) Dmitri
PIL Error: "cannot read interlaced PNG files"   (301 Views)
There, I'm developing an application that lets the user to upload JPG and PNG files. I'm using PIL to check the images after the upload (like checking it storage size, width and height). But PIL raises an error: "cannot read interlaced PNG files" It says that interlaced PNG files are not supported in the PIL documentation. I'm using PIL 1.1.6-2 on Arch Linux.. I can check all images with: from PIL import Image im ='image.png') which returns a dictionary about the image. If the dict has 'interlace' key with the value 1, then I reject the event that's being send with a validation error. But I don't think this is a good idea since this could be very annoying for the users.
cannot declare global vars!   (352 Views)
i had posted earlier for not being able to declare global vars. No i followed the suggestions and created a class, but still the vars do not seem to have a global scope. I have tried pretty much everything. Any advice appreciated... Here: ======================================================== #!/usr/bin/env jython #imports .... class SVNLogs2DBParser: #svnLogging_ #dbTable_ #cmterID_ #projID_ #fileIDNumber_ #Commiter_ #Commit_ #StoredProject_ #ProjectVersion_ #entryList_ def __init__(self,svnLogging_=SVNLogging(SVN_REPOS),dbTable_=DBTablesHandler(),cmterID_=0,projID_=0, fileIDNumber_=0,Commiter_={},Commit_={},StoredProject_={},ProjectVersion_={},entryList_={}): pass #svnLogging_=SVNLogging(SVN_REPOS) #print "Connection established to SVN repository..." #dbTable_=DBTablesHandler() #cmterID_=0 #projID_=0 #fileIDNumber_=0 #Commiter_={} #Commit_={} #StoredProject_={} #ProjectVersion_={} #entryList_={} #reads all the revision logs (traversing them PIVOT at a time) and #processes each log entry def getLogsLoop(self): while svnLogging_.getCurrentRevisionNumber()!=svnLogging_.getLatestRevisionNumber(): entryList_=svnLogging_.getNextLogs(PIVOT); #print "Attempting to go over the HEAD revision..." for entry in self.entryList: print "processing new SVN entry..." processLogEntry(entry) entryList_.clear() #processes each log entry # #"entry" is of type SVNLogEntry. See SVNKit API #"changedPaths" is returned as a java.util.HashMap #with key strings (paths) and values SVNLogEntryPath objects #"entry.getDates()" returns a java.util.Date object def processLogEntry(self, entry): revision = int(entry.getRevision()) commiter = str(entry.getAuthor()) datetime = getTimeStamp(entry.getDate()) message = str(entry.getMessage()) changedPaths = entry.getChangedPaths() #array passed for updating the Commiter DB table Commiter_[0] = cmterID_ Commiter_[1] = commiter dbTable_.updateCommiterTable(Commiter_) #array passed for updating the Commit DB table Commit_[0] = projID_ Commit_[1] = datetime Commit_[2] = cmterID_ Commit_[3] = 0.0 Commit_[4] = "" #properties fileStats=getFileTypes(changedPaths) Commit_[5] = fileStats[0] Commit_[6] = fileStats[2] Commit_[7] = fileStats[1] Commit_[8] = fileStats[3] Commit_[9] = fileStats[4] dbTable_.updateCommitTable(self.Commit_) ProjectVersion_[0]=projID_ ProjectVersion_[1]=0.0 dbTable_.updateProjectVersionTable(ProjectVersion_) Project[0]=projID_ Project[1]="" Project[2]="" Project[3]="" Project[4]="" dbTable_.updateProjectTable(Project_) cmterID_+=1 projID_+=1 ##############################HELPER##METHODS############################### .... ##############################HELPER##METHODS###############################
(Re)announcing APL 2007   (383 Views)
APL 2007 conference on Array Programming co-located with OOPSLA 2007 Sponsor: ACM SIGAPL Where: Montreal When: October 21 (tutorials) October 22/23 (main conference program) Keynote Guy Steele speaker: Sun Microsystems Laboratories Links: Info: Registration: OOPSLA:
cannot create python packages   (363 Views)
i have the following files: current_dir/level1/ current_dir/ ----------- class Called: def exec1(self): print "" ---------- from level1.Called import * c=Called() c.exec1() However it is impossible for to find I even tried to place the level1 structure inside /usr/lib/pythonX.Y/, whithout success however. Any ideas Thnx ___________________________________________________________ Want ideas for reducing your carbon footprint Visit Yahoo! For Good
Repository - file scanner   (363 Views)
Greetings, Could someone point my muddled head at a/the python repository. I know that one exists but cannot find it again. In particular I am looking for a standalone search tool that given a path searches files for a text string.
Calling Usergroup Organizers (and Wannabees)   (376 Views)
We'd like to strengthen and raise the visibility of Python usergroups and foster the creation of new ones, by sharing the valuable experiences of those leaders around the community who make it happen. [1] One step is to make others more aware of what is already happening, perhaps in their own neighborhood re Python meetings. I've created a shared blog and invite organizers of existing groups to send me their email address to get privs to post to it. Because these postings will be distributed far and wide, a posting should be of interest to those who did not attend but are considering doing so, or that might be instructive to organizers in other cities. An overview of what was covered in a past meeting, or an announcement with substance on what an upcoming meeting is going to be about are good postings. A simple date and local address, or that the pizza was good last week, is not. ;-) [2] A second step is to encourage and support new organizers in forming groups in their area. There is a strong demand for such meetings, but many are uncertain how to go about it. Therefore I've created a new mailing list on which experienced and new organizers can share tips on getting started, whether about getting the word out, finding a place to meet or getting interesting speakers. Those of us with a history of involvement in a usergroup often forget that many people have never attended a usergroup meeting, or lack experience in running one, so let's help strengthen this aspect of Python. We could use some videos or photos of group meetings as well, posted to and the link emailed to me for use. I'd also like to reach out to the existing, successful usergroups and ask them to spread the word about their efforts by being interviewed by Ron Stephens on Python411, and/or writing up an article on how your group got started for Tennessee Leeuwenburg of _The Python Papers_. Even a simple "what a typical meeting is like in my area" is helpful. It would be especially interesting to see how usergroups operate in various countries around the world, and perhaps help bring together these regions. In closing, please, for existing usergroups as well as new ones coming online, update the entry for your group on the roster of Python usergroups. Jeff Rush Advocacy Coordinator
PyCon: talks and tutorials announced   (384 Views)
The slate of talks and tutorials for PyCon 2007 is now public. Talks: Tutorials: A first draft of the schedule is at . Caution: This schedule is still subject to change -- speakers may report conflicts that will require some rearrangement, and session times may still shift around a little. Be especially cautious if you're selecting what time to leave on Sunday; if the Sunday afternoon talks are shuffled, you might have to miss an interesting session. Note that the schedule has three -- count' em, *three* lightning talk sessions, so if you want to give a five-minute talk about a project or idea, there's lots of room available. See for more information. Andrew M. Kuchling Co-chair, PyCon 2007 Jeff Rush Co-chair, PyCon 2007
dear comp.lang.python.announce readers   (237 Views)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's getting a bit tiresome seeing one misguided American after another with their cutsie little yellow or red-white-blue ribbons on their outsized SUVs. Yeah, I guess it's the thing to do; maybe part of that whole soccer-mom culture. Unfortunately, the only thing they demonstrate is that the person behind the wheel is a clueless, gullible, misguided, nitwit. If foreign invaders landed on our soil, as we have done in Iraq, I would be the first one to take up arms and repel them. (I suppose that would make me an 'insurgent' by OUR logic.) This, and other aggressive governments have always done their utmost to make it APPEAR as if committing yourself to kill in feuds on distant shores that have nothing to do with the welfare of the citizenry is somehow patriotic. It is not. Enlisting in the armed forces, in the absence of a real and impending foreign threat, is no different that hiring yourself as a paid assassin . . the only difference is, you're not getting paid enough. But let's take a realistic look at exactly WHO joins up in an all-volunteer army. The first group are those who join (during peacetime) for the benefits: to get an education, or because it seems a reasonable career path. Consider carefully! Realize that you are gambling with your humanity. Once you sign that form, you sign away your right to say: "No, that is an atrocity." You put your abilities, including the ability to kill, at the disposal of proven liars, psychopaths . . . enemies of humanity. Do you think that every German soldier in World War II who helped load Jews into cattle cars was a cold-blooded killer Most were poor kids, just like you, who got caught up in the patriotic frenzy. Once you're in, you're IN. You lose the ability to stop killing until they tell you so. This not only makes you less than human, it makes you less than an animal, for even the animals retain their freedom of self determination. The second group are the simple minded, who fall for patriotic entreaties about defending democracy, Mom, apple pie; in other words, all the traditional government propaganda. Do you think Soviet lads subjugated their neighbors throughout the world because they thought the Soviet Union was an EVIL empire No, they were fighting for MOM, and whatever passes for apple pie in Russia. Step back and examine the lies your government is handing you, and ask yourself if they have the ring of truth. Do you want to be one of the murderers in uniform who opened up on their fellow citizens at Kent State When you put on that uniform, you give up all autonomy, and become nothing more than a weapon, to be used for whatever evil purposes the scoundrels in government demand (and, if you look carefully, you will discover that the only interests THEY serve are those of the big businesses that own them.) Finally, you have the hard-core psychopaths. These are the people who WANT to kill. Murder, torture, rape; THESE are the American values upon which THIS group is focused. The cause doesn't matter, they're after the thrill that only warfare can provide. Just remember: killing for George W. Bush, or for George H.W. Bush, or for Lyndon B. Johnson, or for Richard M. Nixon is not the same as defending yourself, your family, your or your country. Don't be a dupe. Don't Enlist! Remember -- supporting the troops means supporting Bush aggression, profiteering, and war crimes. Here's an idea: why not take those ribbons, dip them in blood, and mail them to the White House - -- Tom St.Denis 111 Banning Rd Kanata, Ontario K2L 1C3 Canada Home: (613)836-3160 Cell: (613)796-8220 KeyID: 0x40B640D5 Fingerprint: 53F9 307F F83E D52A 9E63 C2A5 B43F D952 40B6 40D5 -----BEGIN PGP SIGNATURE----- Version: PGP 8.0.3 iQA/AwUBQxLVO7Q/2VJAtkDVEQJnnQCg1mRyNVgZ6Po6Xf7csn62Ph9rkC8AoMxZ Zo8jLvfr6bDGWZb/PhEpz3c8 =2NAY -----END PGP SIGNATURE-----
announcing: "testing-in-python" mailing list   (271 Views)
Folks, catalyzed by the great fun we had at PyCon '07, Grig Gheorghiu and I have created the "testing-in-python" (or "TIP") mailing list. This list will hopefully serve as a forum for discussing Python testing tools, testing approaches useful in Python, Web resources for same, and whatever else people would like to talk about. ("Proposed: The Death Star would not have had a single point of failure had it been written in Python and tested with the Death Star Testing Protocol Tool. Discuss.") Grig has a blog post about the list here: You can sign up for the [mailman] list here: Subscribers can post to the list at ''. List archives are available here: cheers, --titus