Re: python/C++ wrapper

2007-03-14 Thread Szabolcs Nagy
> Well, pyogre has few problems with maintenance, and new bindings to > Ogre engine was > created using Boost.Python( http://www.ogre3d.org/wiki/index.php/PyOgre ) oh last time i played with pyogre they made a transition from boost to swig :) so they are back again at boost (the problem with boos

Re: ZSI, SOAP and .NET web services - problem

2007-03-22 Thread Laszlo Nagy
> I tried to use different library - SOAPpy, but I couldn't. It requires > fpconst library which cannot be installed because its server does not > respond at all. What a shit... > I concur! When I tried to use ZSI the first time, it turned out it has no support for attachments. Next time I it

Re: SimpleXMLRPCServer and Threading

2007-03-29 Thread Laszlo Nagy
Jeff McNeil wrote: > This is off of memory so I apologize if I don't get all of the details right. > > The base SimpleXMLRPCServer uses TCPServer as it's server component > and SimpleXMLXMLRPCRequestHandler as it's handler. The handler is a > subclass of BaseHTTPRequestHandler, which itself doesn't

Windows service and pyc files

2007-04-04 Thread Laszlo Nagy
Hello, I have a win32 service written in Python that starts a plain application, written in Python. The win32 service tries to launch the application in a while loop and logs the return value of the os.system call. That's all. The application is a simple Python program that connects to an ht

Re: calling super()

2007-04-04 Thread Laszlo Nagy
> And here's the error message I get: > > Traceback (most recent call last): > File "e:/PyEN/inherit.py", line 16, in > N = NewPage(); > File "e:/PyEN/inherit.py", line 12, in __init__ > super(NewPage, self).__init__(); > TypeError: super() argument 1 must be type, not classobj > S

Re: calling super()

2007-04-04 Thread Laszlo Nagy
Jarek Zgoda wrote: >> Hello, I have been trying to call the super constructor from my >> derived class but its not working as expected. See the code: >> >> class HTMLMain: >> def __init__(self): >> self.text = ""; >> print(self.text); >> def __del__(self): >> self.te

Re: Windows service and pyc files

2007-04-05 Thread Laszlo Nagy
> > Have you tried the subprocess module for this rather than os.system? > You might be able to pipe errors to a file with it. You might be able > to use the traceback module for more verbose error catching too. > Okay, I'm tried this instead of os.system: def dumpexc(e): import sys,traceback,

Re: Windows service and pyc files

2007-04-05 Thread Laszlo Nagy
> When I call spawn() from a service, this is written into the logfile: > > 2007-04-05 17:52:53,828 INFO .Spawner Spawing > ['C:\\Python25\\lib\\site-packages\\win32\\PythonService.exe', > 'T:\\Python\\Projects\\Test\\Application.py'] > 2007-04-05 17:52:53,828 ERROR .Spawner Traceback (most rece

Re: Windows service and pyc files

2007-04-05 Thread Laszlo Nagy
>> 1. subprocess.Popen cannot redirect stderr and stdout when called from a >> win32 service. This is not documented, and makes debugging almost >> impossible. >> > > Without the patch menctioned in my previous message, you must redirect all > stdin, stdout AND stderr (because the child can

Re: Windows service and pyc files

2007-04-05 Thread Laszlo Nagy
> With a bit of guessing, I think I've found what's happening. > Since you don't provide a value for stdin, None is used. Inside > subprocess.py, method _get_handles, line 670, GetStdHandle *may* return > None; in that case _make_inheritable fails. > If you print the value of p2cread in line 6

convert html entities into real chars

2007-04-10 Thread Laszlo Nagy
Hi, I would like to have a function that can convert '>' into '>', '&' into '&' etc. I could not find how to do it easily (I have a code snippet for the opposite). Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list

Re: convert html entities into real chars

2007-04-10 Thread Laszlo Nagy
> I would like to have a function that can convert '>' into '>', > '&' into '&' etc. I could not find how to do it easily (I have a > code snippet for the opposite). Found it, sorry def convertentity(m): """Convert a HTML entity into normal string (ISO-8859-1)""" if m.group(1)=='#':

Re: calling super()

2007-04-11 Thread Laszlo Nagy
John Clark wrote: > Please be aware that super() has it's own set of gotchas - it's not as clean > as you would hope. For more info: http://fuhm.org/super-harmful/ > > (I'm not the author, I was referred to this article while struggling with > wxPython and super()) > This was interesting! I'm u

Re: ValueError: too many values to unpack

2007-04-11 Thread Laszlo Nagy
fscked írta: > Trying to use CSV to read in a line with 11 fields and I keep getting > this error. I have googled a bit and have been unable to figure it out. > > Probably you have more than 11 values in some (or all) of the rows in the CSV file. Try this code: L = (1,2,3,4,5) a1,a2,a3 = L If

Re: how to pickle objects for database storage?

2007-04-11 Thread Laszlo Nagy
krishnakant Mane írta: > hello, > I have a strange but very interesting requirement? > provided that a database can provide for an object data type like > binary large object (blob), can I store a pickeled python object in > it? > Why not? > I know oracle has blob and clob and believe that mysql

Re: how to pickle objects for database storage?

2007-04-11 Thread Laszlo Nagy
Laszlo Nagy írta: > krishnakant Mane írta: > >> hello, >> I have a strange but very interesting requirement? >> provided that a database can provide for an object data type like >> binary large object (blob), can I store a pickeled python object in >> it? >

Re: ValueError: too many values to unpack

2007-04-11 Thread Laszlo Nagy
> Hmm, well I have counted the fields in the CSV and verified there are > only 11. Here is the offending code: > > Try this instead: lineno = 0 for values in csvreader: try: lineno += 1 boxid, mac, activated, hw_ver, sw_ver, heartbeat, name, address,phone, country, ci

Re: Inconsistent result from urllib.urlopen

2007-04-12 Thread Laszlo Nagy
> Any ideas why I don't get the same result from the python script as I > do from a web browser? This problem seems to be a recent > development. The scripts I wrote like this worked fine for a while > and then stopped working within the past couple of weeks. > Maybe it has to do something wi

Re: c interfacing in 2.5

2007-09-15 Thread Szabolcs Nagy
Diez B. Roggisch wrote: > ctypes is for C. Where it is great to use. if you need simple wrappers then swig and ctypes are both good since they can generate it for you pyrex is also good for wrapping and for writing c extension code > If you need C++-wrapping, I recommend SIP. i recommend py++

gdbm objects not iterable?

2007-10-03 Thread Laszlo Nagy
Hi All, gdbm objects have a "firstkey" and a "nextkey" method. So if I want iterate through the keys (which I often do) then I have to do this: def itergdbmkeys(gdbm_obj): key = gdbm_obj.firstkey() if key is None: raise StopIteration yield key while True: key =

Re: gdbm objects not iterable?

2007-10-03 Thread Laszlo Nagy
>> >> I know that this is a very small change, but it can make gdbm objects >> look more like dictionaries. >> >> Please make comments. :-) >> >> > What you would need is a method to *create and return* a generator, and > it's the generator that should have the next() method. Otherwise you

Re: gdbm objects not iterable?

2007-10-03 Thread Laszlo Nagy
>> E.g. I would not allow to change the keys of the gdbm object during >> iteration. I'm not sure how to detect "end of iteration" though. >> >> (Maybe I misunderstood your question.) >> >> > All I meant was that it's essential to trap this condition. > Dictionary size change is easy to d

Re: Static variable vs Class variable

2007-10-09 Thread Laszlo Nagy
[EMAIL PROTECTED] wrote: > Hi. > > I've got a question on the differences and how to define static and > class variables. AFAIK, class methods are the ones which receives the > class itself as an argument, while static methods are the one which > runs statically with the defining class. > > Hence,

Re: Static variable vs Class variable

2007-10-09 Thread Laszlo Nagy
> Your question "is variable a > static or class variable?" has no real answer. After running the > increment() method on a descendant class, e.g. Child1 will rebind the > name Child1.a, creating a new name in the namespace of the class. So the > variable Foo.a is still there, but you are acce

Re: Static variable vs Class variable

2007-10-09 Thread Laszlo Nagy
Steven D'Aprano wrote: > On Tue, 09 Oct 2007 19:23:37 +0200, Diez B. Roggisch wrote: > > >> Your believes aside, this is simply wrong. The statement >> >> a += x >> >> always leads to a rebinding of a to the result of the operation +. >> > > Not true. > Hmm. Or you can write __iadd__ to

Re: Static variable vs Class variable

2007-10-10 Thread Laszlo Nagy
Steven D'Aprano írta: > On Tue, 09 Oct 2007 21:25:38 +0200, Laszlo Nagy wrote: > > >> a = 1 >> a+= 1 # The compiler will probably optimize this and the Python bytecode >> interpreter will not rebind 'a' here, just increment the integer in >> me

Re: gdbm troubles.

2007-10-11 Thread Laszlo Nagy
Shriphani wrote: > dictionary = gdbm.open('dictionary','c') > dictionary['Ellipsize'] = 'Openbox' > dictionary.get('Ellipsize') > Try this: print dictionary['Ellipsize'] del dictionary['Ellipsize'] gdbm objects are similar to builtin dictionaries. By the way, they are not iterable, but they

Re: Problem with PEXPECT in Python

2007-10-23 Thread Laszlo Nagy
> > > > > cmd ='scp'+' '+source_file+' '+user+'@'+ip+':'+desti_path > You might wanna try to login with a public/private key pair, then scp won't ask for a password. -- http://mail.python.org/mailman/listinfo/python-list

Re: context managers and generators

2007-01-12 Thread Laszlo Nagy
> I'm still thinking there is a better way to do it, and would appreciate > any ideas. > Everything can be implemented with goto and arrays. http://entrian.com/goto/ :-P -- http://mail.python.org/mailman/listinfo/python-list

Re: closing a "forever" Server Socket

2007-01-22 Thread Laszlo Nagy
alessandro írta: > thanks > > infact the server_forever() method is only a serve() method inside an > infinite loop. > > many thanks again, > Here is a snipped that show a "software terminateable threading TCP socker server". The "server" object is a SocketServer instance, server_stopped is a

Re: closing a "forever" Server Socket

2007-01-22 Thread Laszlo Nagy
alessandro írta: > Oh my God! it's really so complicated? > > 3 modules (threading, SocketServer, select) only for design a way to > shutdown a TCP server > ...but they told me that python was easy... :) > I believe that SockerServer was created for testing purposes, although there are some

Re: mmap caching

2007-01-22 Thread Laszlo Nagy
> In fact, memory that is read in because of mmap should *never* cause > a MemoryError. This is certainly not true. You can run out of virtual address space by reading data from a memory mapped file. > Python calls MapViewOfFile when mmap.mmap is invoked, > at which point the operating commits t

Re: mmap caching

2007-01-22 Thread Laszlo Nagy
> It's around 400MB. As I said, I cannot reproduce the MemoryError > locally since I have 1GB physical space but IIRC the user who reported > it had less. Actually I am less concerned about whether a MemoryError > is raised or not in this case and more about the fact that even if > there's no exce

urllib2 question

2007-01-23 Thread Laszlo Nagy
Hi All, I would like to save a URL into a file. I need to manage cookies and use my own HTTP headers so I'm using urllib2 and a custom openerdirector. Here is a code fragment: while True: data = openerdirector.read(1024)

Re: Two dimensional lists

2007-01-25 Thread Laszlo Nagy
> # shouldn't I be able to fill the lists simply by pointing to a location? > > matrix[a_idx, p_idx] = 0x219 # and so on? > Lists are not matrices. For example: L = [ [1,2,3], ['a','b','c'], 10 ] print L[1][2] # Prints 'c', you will like this syntax but... print L[2][5] # TypeError: 10 is not

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> If you don't mind possibly getting a few nonalphanumeric characters: > > import os,binascii > print binascii.b2a_base64(os.urandom(6)) what about file('/dev/urandom').read(6).encode('base64') (oneliner and without import sa op requested) -- http://mail.python.org/mailman/listinfo/python-list

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> If you don't mind possibly getting a few nonalphanumeric characters: > > import os,binascii > print binascii.b2a_base64(os.urandom(6)) what about file('/dev/urandom').read(6).encode('base64') (oneliner and without import as op requested) -- http://mail.python.org/mailman/listinfo/python-list

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Laszlo Nagy
NoName írta: > Hmmm.. > In the Perl example password generates after user hit ENTER not > continously like in Python you wrote... :) > > i want see various ways to generate passwords even if they some > indirect like using BASE64 > I copied this from a recipe, I do not remember which one. I li

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> Is os.urandom cryptographically strong on all platforms? http://docs.python.org/lib/os-miscfunc.html "The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation." -- http://mail.python.org/mailman/listinfo/pyth

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> If you really want a hack, here it is: > > while 1:print > ''.join(__import__('random').choice(__import__('string').letters+'1234567890') > for x in xrange(8)),;n=raw_input() > > This is a one-liner (though mail transmission may split it up), no > import statements. If someone can come up with an

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> while > 1:i=__import__;print''.join(i('random').choice(i('string').letters > +'1234567890')for x in range(8)),;raw_input() > while 1:i=__import__;r='random';print''.join(i(r).choice(i('string').letters +'1234567890')for x in`r`),;raw_input() even shorter: range -> `'random'` :) -- http://m

Re: [Boost.Graph] graph.vertices property creates new objects

2007-01-29 Thread Szabolcs Nagy
> It seems that the vertices iterator creates new vertex objects every > time instead of iterating over the existing ones. This essentially i don't know much about bgl, but this is possible since vertices are most likely not stored as python objects inside boost > prevents, among other things, s

Re: python 2.3 module ref

2007-01-29 Thread Szabolcs Nagy
> any pointers to a 2.3 module ref? also look at: http://rgruet.free.fr/PQR2.3.html#OtherModules when coding for different python versions i can reccommend this quick ref: http://rgruet.free.fr/ (every language feature is colorcoded according to the version when it was included) -- http://m

Re: deepcopy alternative?

2007-01-29 Thread Szabolcs Nagy
> I believe the only thing stopping me from doing a deepcopy is the > function references, but I'm not sure. If so is there any way to > transform a string into a function reference(w/o eval or exec)? what's your python version? for me deepcopy(lambda:1) does not work in py2.4 but it works in py2

Re: Is any python like linux shell?

2007-01-30 Thread Szabolcs Nagy
Brian Visel wrote: > ipython is probably what you're looking for. or http://sourceforge.net/projects/pyshell -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I know both the Key c and Ctrl on the keyboard are pressed?

2007-01-30 Thread Szabolcs Nagy
[EMAIL PROTECTED] wrote: > Hi; > How can I know the Key c and Ctrl on the keyboard are pressed? Or how > to let the program press the > > key Ctrl+c automatically? I just want to use python to develop a > script program. > gear depends on where you got your input from and what do you exactly want

Re: data design

2007-01-30 Thread Szabolcs Nagy
> The lazy way to do this: have modules that initialize bunches of > objects, attributes holding the data: the object is somehow the row of > the "table", attribute names being the column. This is the way I > proceeded up to now. > Data input this way are almost "configuration data", with 2 big > d

Re: data design

2007-01-30 Thread Szabolcs Nagy
> Hurray for yaml! A perfect fit for my need! And a swell tool! > Thanks a lot! i warn you against yaml it looks nice, but the underlying format is imho too complex (just look at their spec.) you said you don't want python source because that's too complex for the users. i must say that yaml i

Re: Python tools to manipulate JARs ?

2007-01-31 Thread Laszlo Nagy
Andy Dingley írta: > I run build processes for a Java shop using Python (and some Ant). > > Would anyone care to suggest favoured tools for manipulating the > innards of JARs? Or do I just treat them as plain zipfiles and get > stuck right in there? > > Mainly I'm trying to query lists of classes a

Re: Python **kwargs ?

2007-01-31 Thread Szabolcs Nagy
johnny wrote: > What is **kwargs mean in python? When you put double **, does it mean > passing by reference? here's a little example: >>> def f(a, *args, **kw): ... print 'a:',a ... print 'args:',args ... print 'kw:',kw ... >>> f(1,2,3,x=4) a: 1 args: (2, 3) kw: {'x': 4} >>> f(a=1,

Re: Newbie question: replacing nulls in CSV with preceding value

2007-02-01 Thread Laszlo Nagy
> import csv > citynew='' > reader = csv.DictReader(open("/home/mwaite/test/test2.csv", "rb")) > for row in reader: > row['CITY'] == citynew > else: > citynew=row['CITY'] > > The logic here -- in this case trying to fill in the city information > -- would seem to work, but I'm not sure. An

Re: Python does not play well with others

2007-02-03 Thread Szabolcs Nagy
Paul Rubin wrote: > "George Sakkis" <[EMAIL PROTECTED]> writes: > > > What does "batteries included" mean to you? To me, it means you don't > > > have to install add-ons. > > > > So let's make a 500MB executable and add Numpy, Zope, Django, PIL, > > pretty much everything actually. Even better, m

Re: C parsing fun

2007-02-05 Thread Szabolcs Nagy
> based on concepts my boss had. To do this I needed to represent C++ > code structure in Python somehow. I read the docs for Yapps, pyparsing > and other stuff like those, then I came up with a very simple idea. I > realized that bracketed code is almost like a Python list, except I > have to repl

Re: mplayer bug or python bug?

2007-02-07 Thread Szabolcs Nagy
Marco wrote: > The following code is my test program for control mplayer. > in movies/ there are about 20 movies, the code plays them in circle, > but mplayer will crash silently after a circle, the "sliently" means I > can handle popen2 without except, but no movie. i had some problem with mplay

Re: Best Free and Open Source Python IDE

2007-02-09 Thread Szabolcs Nagy
Srikanth wrote: > Yes, > > All I need is a good IDE, I can't find something like Eclipse (JDT). > Eclipse has a Python IDE plug-in but it's not that great. Please > recommend. > > Thanks, > Srikanth try pida http://pida.co.uk/index.php/Main_Page -- http://mail.python.org/mailman/listinfo/python

Re: python linux distro

2007-02-09 Thread Szabolcs Nagy
> Now what would be interesting (and *really* crazy) would be Linux (or > BSD or whatever) distro written almost entirely *in* Python, with the > goal of eliminating as much bash/sh as possible. > > That would be fun. actually there was(is) an os whitch is written "almost entirely *in* Python": h

Re: python linux distro

2007-02-10 Thread Szabolcs Nagy
> ^was(is)^may one day be, but probably not,^ > > From the quoted page: > > """The project is in an early development phase and as of January 2007, > no significant progress was being made due to lack of developer time.[5]""" well actually i managed to boot unununium in qemu so it _is_ an os but

Re: favourite editor

2007-02-11 Thread Szabolcs Nagy
azrael wrote: > Since i'm new on this forum, and first time meeting a python comunity, > i wanted to ask you for your python editors. > > Im looking for some good python editor, with integrated run function, > without having to set it up manualy like komodo. > I found the pyscripter, and it has al

_ssl.pyd is buggy?

2007-02-13 Thread Laszlo Nagy
Hello, I wrote a small program that uses xmlrpc over https. It should work as a win32 application and as a win32 service too. There is a file called Processor.py that contains the main thread of the program. It is called from two files: win32_Application.py and win32_Service.py. The applic

Re: _ssl.pyd is buggy?

2007-02-13 Thread Laszlo Nagy
> I was using _ssl.pyd to upload files to DAV server over ssl and > found it to be a problem. I upgraded to Python 2.5 and the problem > was fixed. I don't know if it is the same problem that is affecting > you, but I couldn't get it to work on 2.4. > > FYI, Larry > I just installed Python 2

Re: _ssl.pyd is buggy?

2007-02-13 Thread Laszlo Nagy
> Services usually run under the LOCAL_SERVICE account, which is rather > limited on what it is allowed to do (It has no access to network shares, > by example). Perhaps this is afecting your program. > I'm sorry, it is not. My service only uses the standard output, writes into different f

Re: f---ing typechecking

2007-02-14 Thread Szabolcs Nagy
Sergey Dorofeev wrote: > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> (1,)+[1] > Traceback (most recent call last): > File "", line 1, in > TypeError: can only concatenate tupl

Re: Recursive calls and stack

2007-02-14 Thread Szabolcs Nagy
[EMAIL PROTECTED] wrote: > Hi, > I have a program which literately finds the object that overlapping a > point. The horizontal and vertical search are called recursively from > inside each other. > ... in case you ever need deeply nested recursion: one solution is to use the already mentioned sy

metaclasses (beginner question)

2007-02-21 Thread Laszlo Nagy
Hello, I would like to create a hierarchy classes, where the leaves have a special attribute called "producer_id". In addition, I would like to have a function that can give me back the class assigned to any producer_id value. I tried to implement this with a metaclass, but I failed. Pleas

Re: metaclasses (beginner question)

2007-02-21 Thread Laszlo Nagy
> Without looking into the details -- the (subclass of) type is meant to be > the class of the class, or the other way round, your normal classes are > instances of (a subclass of) type. You determine the factory Python uses to > make a class by adding > > __metaclass__ = factory > > to the class

Re: Regex Speed

2007-02-22 Thread Szabolcs Nagy
> Well, just as an idea, there is a portable C library for this at > http://laurikari.net/tre/ released under LGPL. If one is willing to > give up PCRE extensions for speed, it might be worth the work to > wrap this library using SWIG. actually there is a python binding in the tre source with an

Re: What is the best queue implemetation in Python?

2007-02-23 Thread Szabolcs Nagy
> For that purpose I have used the good deque that you can find in > collections in the standard library. It's very good for queues, and > it's a bit faster than regular lists for stacks too. you mean *much* faster (since a list is a reference array so pop(0) is O(n) operation) never use a list a

Re: pydoc - generating HTML docs from string input

2007-11-07 Thread Laszlo Nagy
[EMAIL PROTECTED] wrote: > Has anyone ever tried mucking with pydoc to the point where you can > get it to give you output from a string input? For example I'd like > to give it a whole module to generate documentation for but all within > a string: > > #little sample > > module_code=''' > """Modu

Re: Python-URL! - weekly Python news and links (Nov 12)

2007-11-12 Thread Laszlo Nagy
Gabriel Genellina wrote: > QOTW: "AOP is a programming paradigm in the same way indie is a genre of > film." - Carl Banks > http://groups.google.com/group/comp.lang.python/msg/224e922a3e1a8638 > I was following links and hit PEP 246 here: http://www.python.org/dev/peps/pep-0246/ On that

Re: Override method name and original method access

2007-11-12 Thread Laszlo Nagy
Donn Ingle wrote: > In an unusual twist of code I have a subclass which overrides a method but > it also needs to call the original method: > > class One: > def add (self, stuff): > self.stuff.append(stuff) > > class Two(One): > def __init__(self, otherstuff): > (otherstuff) #otherstuff must

Re: Transfer socket connection between programs

2007-11-12 Thread Laszlo Nagy
JamesHoward wrote: > Does anyone know any method to have one program, acting as a server > transfer a socket connection to another program? I looked into > transferring the connection via xml rpc to no avail. It seems to be a > problem of getting access to a programs private memory space and > gi

Re: imaplib unexpected error

2007-11-12 Thread Laszlo Nagy
KeefTM wrote: > Hello, I am getting an odd error when trying to establish an IMAP > connection: > > File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/ > imaplib.py", line 904, in _get_response > raise self.abort("unexpected response: '%s'" % resp) > imaplib.abort: unexpecte

Re: Issue with wxPython GUI

2007-11-12 Thread Laszlo Nagy
> > *New Problem: *I am opening and executing a script from the GUI. The > script has a many log messages, > which it posts on some shared memory. The GUI reads the messages from > the shared memory, > in the Idle loop. But the script is huge and so the logging is not > run-time. > Rather this

Re: Issue with wxPython GUI

2007-11-13 Thread Laszlo Nagy
tarun írta: > Hi Laszlo Nagy, > > Thanks a lot. > But the issue over here is that how will the child thread acknowledge > the main thread that it has completed its task. For this I'll have to > set some flag in the child thread and poll for it in the main thread. >

Re: Issue with wxPython GUI

2007-11-13 Thread Laszlo Nagy
tarun wrote: > Thanks a lot Laszlo Nagy, > > I used the following and it worked. I thought this is a producer/consumer scenario, this is why I suggested the Queue class. But now I see that you only want to compute one value in your thread and stop it afterwards. In fact using a wx.P

Re: Creating Installer or Executable in Python

2007-11-14 Thread Laszlo Nagy
DanielJohnson wrote: > I have a small project which has around 10 .py files and I run this > project using command line arguments. I have to distribute this > project to somebody. > > I was wondering how can I make an executable or some kind of > installer, so that end user doesn't need to compile

Re: Volume id

2007-11-15 Thread Laszlo Nagy
Gabor Urban wrote: > Hi, > > I have a problem, which may be trivial, but I could not find an answer. > > I have to write a Python script, which does a directory tree walking > on given mounted disk. But I do need to extract the volume id, > somehow. And that's the problem. An additional issue, t

Re: how to figure out if python was used as a cgi script

2007-11-15 Thread Laszlo Nagy
ce wrote: > hi, > > is there a way to figure out which scripting language was used in a > cgi. I used to watch extensions (i.e. py, pl, asp or php) nowadays i > hardly see any extensions and really it is hard to find out anything > from the generated HTML or even the HTML being sent out through the

Re: securing a python execution environment...

2007-11-19 Thread Laszlo Nagy
Chris Withers wrote: > Hi All, > > I'm trying to build a secure execution environment for bits of python > for two reasons: > > - to allow users of the system to write scripts in python without > circumventing the application's security model > > - to allow the system to have an environment where

Re: securing a python execution environment...

2007-11-19 Thread Laszlo Nagy
Alberto Berti wrote: > maybe using import hooks? > > http://www.python.org/dev/peps/pep-0302/ > > I don't think so. Anyone can hook the import statement. And this is just one reason. Some objects are built in. For example, file(). How can you restrict file creation? I believe that there is no

Re: How to add a Decorator to a Class Method

2007-11-20 Thread Laszlo Nagy
> Thanks those answers make sense. But for this function if defined > outside the class: > > >> def pre(fn): >> def new_func(*args, **kwargs): >> print "'hi'" >> fn(*args, **kwargs) >> return new_func >> > > Can new_func reference self? Would self just be one of t

Re: How to add a Decorator to a Class Method

2007-11-20 Thread Laszlo Nagy
>> Can new_func reference self? Would self just be one of the args? >> >> -Greg >> > > For methods, self is always "just one of the args". When the > decorator is applied to a method, self will be args[0] in new_func. > If you want to use the name "self" instead of args[0] you can: def

Re: sendmail a long message

2007-11-21 Thread Laszlo Nagy
Helmut Jarausch wrote: > Hi, > > to send a possibly long email I have seen a solution > which does os.popen to an external sendmail program and > then writes the message into that pipe. > > I wonder if it possible to use smtplib.SMTP.sendmail > but this requires building the complete body as one lo

Re: Control mouse position and clicking

2007-11-28 Thread Laszlo Nagy
Paul McGuire wrote: > On Nov 28, 1:29 pm, Glich <[EMAIL PROTECTED]> wrote: > >> hi, how can I, control mouse position and clicking from python? >> >> I want to interact with a flash application inside firefox. thanks. >> >> ps: I am not using windows. >> > > Ooof, I was about to suggest usi

kniterbasdb and datetime

2007-12-13 Thread Laszlo Nagy
Hi All, I connected to a FireBird 1.5 database this way: import kinterbasdb kinterbasdb.init(type_conv=200) # See http://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mxdatetime_required Then I try to update the database: sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?" para

Re: kniterbasdb and datetime

2007-12-13 Thread Laszlo Nagy
DarkBlue írta: > On Dec 13, 7:45 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > >> Hi All, >> >> I connected to a FireBird 1.5 database this way: >> >> import kinterbasdb >> kinterbasdb.init(type_conv=200) # >> Seehttp://kinterba

Re: kniterbasdb and datetime

2007-12-13 Thread Laszlo Nagy
>> Kinterbasdb probably expects the format looking like >> >> month/day/year >> >> rather than >> >> year-month-day >> All right, I tried the month/day/year version: print sql print params cur.execute(sql,params) Results in: Inserting new TTT codes...insert into ttt( ID, T

Re: Guide to using python for bash-style scripting

2006-05-23 Thread Szabolcs Nagy
python subprocess module docs: http://docs.python.org/dev/lib/node517.html -- http://mail.python.org/mailman/listinfo/python-list

Re: hi,everyone. a problem with shelve Module

2006-05-26 Thread Laszlo Nagy
[EMAIL PROTECTED] i'rta: > >> i only write ten records like this: > > >>name sex age > > >> jimmale 22 > >> tom male 23 > >> lucy female 21 >

urllib2 and HTTP 302

2006-05-26 Thread Laszlo Nagy
Hello, The code below uses urllib2 and build_opener. Having this code fragment, how can I return the redirection URL? I tried to get this information from the exception but I could not. Is it possible to read it from the openerdirector? Any suggestions? try: self

Re: Running Python scripts under a different user

2006-05-26 Thread Laszlo Nagy
Hello Diez, Please see below. > And as you refrain form telling us which OS you are running under one > can only be very vague on what to suggest - UNIXish OSes have for > example the setguid-bit, sudo springs to mind and under certain desktops > there are ways to acquire root-settings (but y

Want a strange XML RPC server

2008-01-08 Thread Laszlo Nagy
Hi, I would like to have a strage XML RPC server. It should use one main thread for all connections. I have some code like this (using a custom RPC server class): server_address = (LISTEN_HOST, LISTEN_PORT) # (address, port) server = mess.SecureXMLRPCServer.SecureXMLRPCServer(

ftplib question (cannot open data connection)

2008-01-11 Thread Laszlo Nagy
Hi All, I'm using a simple program that uploads a file on a remote ftp server. This is an example (not the whole program): def store(self,hostname,username,password,destdir,srcpath): self.ftp = ftplib.FTP(hostname) self.ftp.login(username,password) self.ftp.set_pasv(False) se

Re: ftplib question (cannot open data connection)

2008-01-13 Thread Laszlo Nagy
> BUT: active FTP does not just send the data to the port that was in > the random port that was sent to the server... it addresses to the port > you sent, but it sends its data response FROM port 20. This means the > response looks like a totally unsolicited connection attempt from the > ou

simpleparse - what is wrong with my grammar?

2008-02-24 Thread Laszlo Nagy
The program below gives me "segmentation fault (core dumped)". Environment: Linux gandalf-desktop 2.6.20-16-generic #2 SMP Tue Feb 12 05:41:34 UTC 2008 i686 GNU/Linux Python 2.5.1 What is wrong with my grammar? Can it be an internal error in simpleparse? Thanks, Laszlo from simplepa

Re: simpleparse - what is wrong with my grammar?

2008-02-25 Thread Laszlo Nagy
>> > You've created an infinitely recursing grammar. SimpleParse is a > straightforward recursive descent parser without look-ahead (unless > explicitly coded) or ambiguity resolution. You are asking it to parse > "expr" to see if "expr,binop,expr" is matched. It will continue > recursing

ZSI and attachments

2008-03-11 Thread Laszlo Nagy
Hi All, I wonder if the newest ZSI has support for attachments? Last time I checked (about a year ago) this feature was missing. I desperately need it. Alternatively, is there any other SOAP lib for python that can handle attachments? Thanks, Laszlo -- http://mail.python.org/mailman/l

Decode email subjects into unicode

2008-03-18 Thread Laszlo Nagy
Hi All, 'm in trouble with decoding email subjects. Here are some examples: > =?koi8-r?B?4tnT1NLP19nQz8zOyc3PIMkgzcHMz9rB1NLB1M7P?= > [Fwd: re:Flags Of The World, Us States, And Military] > =?ISO-8859-2?Q?=E9rdekes?= > =?UTF-8?B?aGliw6Fr?= I know that "=?UTF-8?B" means UTF-8 + base64 encoding,

Re: Decode email subjects into unicode

2008-03-18 Thread Laszlo Nagy
Sorry, meanwhile i found that "email.Headers.decode_header" can be used to convert the subject into unicode: > def decode_header(self,headervalue): > val,encoding = decode_header(headervalue)[0] > if encoding: > return val.decode(encoding) > else: > return val However, there are malformed emails

Re: Decode email subjects into unicode

2008-03-19 Thread Laszlo Nagy
Gertjan Klein wrote: > Laszlo Nagy wrote: > > >> However, there are malformed emails and I have to put them into the >> database. What should I do with this: >> > [...] > >> There is no encoding given in the subject but it contains 0x92. When I

<    1   2   3   4   5   6   7   8   9   >