Re: I want to use a C++ library from Python
Hello all and thanks for replying, Diez B. Roggisch wrote: Which actually isn't really helpful, as a DLL itself says nothing about what language was used to create it - and sending the OP to e.g. ctypes makes no sense at all in the face of C++. The library - or more precisely the calling convention of the library - is related to the solution. On Windows a dll might be a container for a .NET assembly and C++ code can (theoretically) be compiled to .NET, too. No, the library is not an .NET assembly. It's an VC++ Library compiled as an Dll. Whereas the first link for python c++ is Boost::Python, a C++-wrapper to make C++-code accessible from Python. C++ bindings can be created with SIP, SWIG, Boost or hand written code. Multiple sites claim that SIP generates the fastest code. I have looked (very briefly) at the three framework you mention but they all need the source code of the C++? I don't have the source code! Just the header files and the library and dll. Have I overlooked something or am I just screwed? // Anders -- English is not my first, or second, language so anything strange, or insulting, is due to the translation. Please correct me so I may improve my English! -- http://mail.python.org/mailman/listinfo/python-list
Re: I want to use a C++ library from Python
Anders Eriksson wrote: I have looked (very briefly) at the three framework you mention but they all need the source code of the C++? No, they need header files and an import library to be able to compile the bindings and link them to your DLL. Do you know enough about C/C++ build issues to be able to compile a C++ program against the given library? If you do, fixing the rest should be straightforward, since the binding is just another C++ program designed to be imported by Python. /F -- http://mail.python.org/mailman/listinfo/python-list
XML RPC Problem....
Hi everyone, I am trying to call a function named system.auth at the server side running at localhost:8080 but at the same time i want to set the http header. I found that header can be set by h.putheader(AUTHORIZATION, Basic %s%encodestring(%s:%s % (ustring,text_ucert))) #ustring: just a random string #text_ucert: a file containing the X509 certificate of client And i also fount that a typical system.auth call will look like: POST /xmlrpc/clarens_server.py HTTP/1.0 Host: localhost User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com) Content-Type: text/xml Content-Length: 105 AUTHORIZATION: Basic MkhVTm9VazYxbXArVEZLS0dCY2tIRlA3bjVzPQo6RnJvbSBi ?xml version='1.0'? methodCall methodNamesystem.auth/methodName params /params /methodCall Problem is that i don't know how do i generate above xml system.auth call. Can anyone please tell me how do call a function, setting the header of the call too? -- http://mail.python.org/mailman/listinfo/python-list
Use Python to solve equations?
Hello group, Is there any packages in Python that will help me solve functions similar to this: x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? Thank you, Kelie -- http://mail.python.org/mailman/listinfo/python-list
Re: Refcount problem in ceval.c
Christian Heimes [EMAIL PROTECTED] writes: Berthold Höllmann wrote: Is there any common reason to for such a strange object on the command stack, or is it more likely that any of my extension modules is causing havoc? It's very likely that your extension has a reference counting bug. It looks like you are either missing a Py_INCREF or you have a Py_DECREF too much. Newly freed memory is filled with 0xDB (see Objects/obmalloc.c DEADBYTE). I was suspecting this, that's why I build the debugging version of Python. I hoped I would get the error message somewhere near the code causing the error, but I seems i have to continue the search. Wild guess: Are you using PyModule_AddObject with a PyTypeObject w/o Py_INCREF()ing the type object first? That would have been easy :-) I have only one occurrence of PyModule_AddObject, and its PyTypeObject is Py_INCREF()ed Thanks Berthold -- __ Address: G / \ L Germanischer Lloyd phone: +49-40-36149-7374 -++- Vorsetzen 35 P.O.Box 111606 fax : +49-40-36149-7320 \__/ D-20459 HamburgD-20416 Hamburg pgpRObfd5AOUq.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: XML RPC Problem....
Usman Ajmal wrote: And i also fount that a typical system.auth call will look like: POST /xmlrpc/clarens_server.py HTTP/1.0 Host: localhost User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com http://www.pythonware.com) Content-Type: text/xml Content-Length: 105 AUTHORIZATION: Basic MkhVTm9VazYxbXArVEZLS0dCY2tIRlA3bjVzPQo6RnJvbSBi ?xml version='1.0'? methodCall methodNamesystem.auth/methodName params /params /methodCall Problem is that i don't know how do i generate above xml system.auth call. Can anyone please tell me how do call a function, setting the header of the call too? you need to plugin a custom transport. see this page for an example: http://www.python.org/doc/lib/xmlrpc-client-example.html in your case, it should be sufficient to override send_request, e.g. (untested): class SecureTransport(xmlrpclib.Transport): def set_authorization(self, ustring, text_ucert): self.authoriation = encodestring( %s:%s % (ustring,text_ucert) ) def send_request(self, connection, handler, request_body): connection.putrequest(POST, handler) connection.putheader(Authorization, Basic %s % self.authorization ) and instantiate the transport by doing t = SecureTransport() t.set_authorization(ustring, text_ucert) before passing to the server proxy. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Use Python to solve equations?
Hi Kelie, Check out sympy it is capable of doing things like this. cheers James On Thu, Sep 11, 2008 at 5:09 PM, Kelie [EMAIL PROTECTED] wrote: Hello group, Is there any packages in Python that will help me solve functions similar to this: x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? Thank you, Kelie -- http://mail.python.org/mailman/listinfo/python-list -- -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic allocation file buffer
On Wed, 10 Sep 2008 11:59:35 -0700, Aaron \Castironpi\ Brady wrote: On Sep 10, 5:24 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 10 Sep 2008 09:26:20 +0200, Fredrik Lundh wrote: Steven D'Aprano wrote: You've created a solution to a problem which (probably) only affects a very small number of people, at least judging by your use-cases. Who has a 4GB XML file Getting 4GB XML files from, say, logging processes or databases that can render their output as XML is not that uncommon. They're usually record-oriented, and are intended to be processed as streams. And given the right tools, doing that is no harder than doing the same to a 4GB text file. Fair enough, that's a good point. But would you expect random access to a 4GB XML file? If I've understood what Castironpi is trying for, his primary use case was for people wanting exactly that. -- Steven Steven, Are you claiming that sequential storage is sufficient for small amounts of data, and relational db.s are necessary for large amounts? I'm no longer *claiming* anything, I'm *asking* whether random access to a 4GB XML file is something that is credible or useful. It is my understanding that XML is particularly ill-suited to random access once the amount of data is too large to fit in RAM. I'm interested in what Fredrik has to say about this, as he's the author of ElementTree. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: universal unicode font for reportlab
Tim Roberts [EMAIL PROTECTED] wrote: Duncan Booth [EMAIL PROTECTED] wrote: Laszlo Nagy [EMAIL PROTECTED] wrote: I need to use HTML anyway. I realized that universal unicode fonts are above 5MB in size. The report would be a 10KB PDF, but I need to embed the font before I can send it to anyone. Since some reports needs to be sent in emails, I need to use something else. I cannot be sending 10MB emails for one page reports. I thought that usually when you embed a font in a PDF only the glyphs which are actually used in the document get embedded. Unfortunately a quick test with reportlab seems to show that it doesn't do that optimisation: it looks as though it just embeds the entire font. No, it does subsetting. There was a debate a year or two ago on the reportlab list about how the font subset should be named in the resulting PDF file. Is it possible you have an older release? It was 2.1 downloaded about 30 minutes before my post. The not too scientific test I did was to copy the font embedding example from the Reportlab documentation, modify it enough to make it actually run, and then change the output to have only one glyph. The resulting PDF is virtually identical. I'm not a reportlab expert though so I may have made some blindingly obvious beginners mistake (or maybe it only subsets fonts over a certain size or glyphs outside the ascii range?). -- rlab.py import os, sys import reportlab folder = os.path.dirname(reportlab.__file__) + os.sep + 'fonts' afmFile = os.path.join(folder, 'LeERC___.AFM') pfbFile = os.path.join(folder, 'LeERC___.PFB') from reportlab.pdfbase import pdfmetrics justFace = pdfmetrics.EmbeddedType1Face(afmFile, pfbFile) faceName = 'LettErrorRobot-Chrome' # pulled from AFM file pdfmetrics.registerTypeFace(justFace) justFont = pdfmetrics.Font('LettErrorRobot-Chrome',faceName,'WinAnsiEncoding') pdfmetrics.registerFont(justFont) from reportlab.pdfgen.canvas import Canvas canvas = Canvas('temp.pdf') canvas.setFont('LettErrorRobot-Chrome', 32) if sys.argv: canvas.drawString(10, 150, ' TT TT TT') canvas.drawString(10, 100, 'T') else: canvas.drawString(10, 150, 'This should be in') canvas.drawString(10, 100, 'LettErrorRobot-Chrome') canvas.save() --- -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
hofer [EMAIL PROTECTED] wrote: Let's take following perl code snippet: %myhash=( one = 1, two = 2, three = 3 ); ($v1,$v2,$v3) = @myhash{qw(one two two)}; # -- line of interest print $v1\n$v2\n$v2\n; How do I translate the second line in a similiar compact way to python? One point I haven't seen in the other responses is that, at least for the example given, you don't need the second line at all: mydict={ 'one': 1, 'two': 2, 'three': 3 } print %(one)s\n%(two)s\n%(two)s % mydict -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: universal unicode font for reportlab
Duncan Booth [EMAIL PROTECTED] wrote: I may have made some blindingly obvious beginners mistake I made the blindingly stupid beginners mistake of cleaning up the code before posting it and breaking it in the process. The 'if' should of course say: if len(sys.argv) 1: However my original test was done by toggling commented out lines of code so my conclusion remains the same: the only differences between the output are the creation date, the page stream, and the digest. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: emulating read and readline methods
On Sep 10, 7:54 pm, John Machin [EMAIL PROTECTED] wrote: On Sep 11, 8:01 am, MRAB [EMAIL PROTECTED] wrote: On Sep 10, 6:59 pm, Sean Davis [EMAIL PROTECTED] wrote: I have a large file that I would like to transform and then feed to a function (psycopg2 copy_from) that expects a file-like object (needs read and readline methods). I have a class like so: class GeneInfo(): def __init__(self): #urllib.urlretrieve('ftp://ftp.ncbi.nih.gov/gene/DATA/ gene_info.gz',/tmp/gene_info.gz) self.fh = gzip.open(/tmp/gene_info.gz) self.fh.readline() #deal with header line def _read(self,n=1): for line in self.fh: if line=='': break line=line.strip() line=re.sub(\t-,\t,line) rowvals = line.split(\t) yield \t.join([rowvals[i] for i in [0,1,2,3,6,7,8,9,10,11,12,14]]) + \n def readline(self,n=1): return self._read().next() def read(self,n=1): return self._read().next() Each time readline() and read() call self._read() they are creating a new generator. They then get one value from the newly-created generator and then discard that generator. What you should do is create the generator in __init__ and then use it in readline() and read(). def close(self): self.fh.close() and I use it like so: a=GeneInfo() cur.copy_from(a,gene_info) a.close() It works well except that the end of file is not caught by copy_from. I get errors like: psycopg2.extensions.QueryCanceledError: COPY from stdin failed: error during .read() call CONTEXT: COPY gene_info, line 1000: for a 1000 line test file. Any ideas what is going on? I wonder whether it's expecting readline() and read() to return an empty string at the end of the file instead of raising StopIteration. Don't wonder; ReadTheFantasticManual: read( [size]) ... An empty string is returned when EOF is encountered immediately. ... readline( [size]) ... An empty string is returned only when EOF is encountered immediately. Thanks. This was indeed my problem--not reading the manual closely enough. And the points about the iterator being re-instantiated were also right on point. Interestingly, in this case, the code was working because read() and readline() were still returning the next line each time since the file handle was being read one line at a time. Sean -- http://mail.python.org/mailman/listinfo/python-list
Re: XML RPC Problem....
Thanks for ur help. But now i am getting an error xmlrpclib.ProtocolError: ProtocolError for localhost:8000/RPC2: 500 Internal Server Error Here is my code at http://privatepaste.com/d81Kut9AFj Any idea what wrong am i doing? On Thu, Sep 11, 2008 at 7:18 AM, Fredrik Lundh [EMAIL PROTECTED]wrote: Usman Ajmal wrote: And i also fount that a typical system.auth call will look like: POST /xmlrpc/clarens_server.py HTTP/1.0 Host: localhost User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com http://www.pythonware.com) Content-Type: text/xml Content-Length: 105 AUTHORIZATION: Basic MkhVTm9VazYxbXArVEZLS0dCY2tIRlA3bjVzPQo6RnJvbSBi ?xml version='1.0'? methodCall methodNamesystem.auth/methodName params /params /methodCall Problem is that i don't know how do i generate above xml system.auth call. Can anyone please tell me how do call a function, setting the header of the call too? you need to plugin a custom transport. see this page for an example: http://www.python.org/doc/lib/xmlrpc-client-example.html in your case, it should be sufficient to override send_request, e.g. (untested): class SecureTransport(xmlrpclib.Transport): def set_authorization(self, ustring, text_ucert): self.authoriation = encodestring( %s:%s % (ustring,text_ucert) ) def send_request(self, connection, handler, request_body): connection.putrequest(POST, handler) connection.putheader(Authorization, Basic %s % self.authorization ) and instantiate the transport by doing t = SecureTransport() t.set_authorization(ustring, text_ucert) before passing to the server proxy. /F -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic allocation file buffer
Steven D'Aprano wrote: I'm no longer *claiming* anything, I'm *asking* whether random access to a 4GB XML file is something that is credible or useful. It is my understanding that XML is particularly ill-suited to random access once the amount of data is too large to fit in RAM. An XML file doesn't contain any indexing information, so random access to a large XML file is very inefficient. You can build (or precompute) index information and store in a separate file, of course, but that's hardly something that's useful in the general case. And as I said before, the only use case for *huge* XML files I've ever seen used in practice is to store large streams of record-style data; data that's intended to be consumed by sequential processes (and you can do a lot with sequential processing these days; for those interested in this, digging up a few review papers on data stream processing might be a good way to waste some time). Document-style XML usually fits into memory on modern machines; structures larger than that are usually split into different parts (e.g. using XInclude) and stored in a container file. Random *modifications* to an arbitrary XML file cannot be done, as long as you store the file in a standard file system. And if you invent your own format, it's no longer an XML file. /F -- http://mail.python.org/mailman/listinfo/python-list
Adding environment variables to bash.
Hello folks Can i add any environment variable to bash from my python script? so that when i use env command then i can see that environment variable. Thanks Aditya -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
hofer [EMAIL PROTECTED] wrote: Let's take following perl code snippet: %myhash=( one = 1, two = 2, three = 3 ); ($v1,$v2,$v3) = @myhash{qw(one two two)}; # -- line of interest print $v1\n$v2\n$v2\n; How do I translate the second line in a similiar compact way to python? Below is what I tried. I'm just interested in something more compact. mydict={ 'one' : 1, 'two' : 2, 'three' : 3 } # first idea, but still a little too much to type [v1,v2,v3] = [ mydict[k] for k in ['one','two','two']] # for long lists lazier typing,but more computational intensive # as split will probably be performed at runtime and not compilation time [v1,v2,v3] = [ mydict[k] for k in 'one two two'.split()] As an ex-perl programmer and having used python for some years now, I'd type the explicit v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars Or maybe even v1 = mydict['one'] # 54 chars v2 = mydict['two'] v3 = mydict['two'] Either is only a couple more characters to type. It is completely explicit and comprehensible to everyone, in comparison to v1,v2,v3 = [ mydict[k] for k in ['one','two','two']] # 52 chars v1,v2,v3 = [ mydict[k] for k in 'one two two'.split()] # 54 chars Unlike perl, it will also blow up if mydict doesn't contain 'one' which may or may not be what you want. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: max(), sum(), next()
Hi, Luis Zarrabeitia wrote: Quoting Laszlo Nagy [EMAIL PROTECTED]: ... Even better: help(sum) shows === sum(...) sum(sequence, start=0) - value Returns the sum of a sequence of numbers (NOT strings) plus the value of parameter 'start'. When the sequence is empty, returns start. === so the fact that sum([]) returns zero is just because the start value is zero... sum([],object()) would return an object(). BTW, the original code: sum(s for s in [a, b] if len(s) 2) wouldn't work anyway... it seems that sum doesn't like to sum strings: sum(['a','b'],'') type 'exceptions.TypeError': sum() can't sum strings [use ''.join(seq) instead] Yes which is a bit bad anyway. I don't think hard wiring it is such a nice idea. You know, walks like a duck, smells like a duck... If it makes sense to handle things differently for performance, then please have it doing it silently, e.g. when it detects strings just use join() internally. Cheers Tino smime.p7s Description: S/MIME Cryptographic Signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Use Python to solve equations?
Thank you James! Checking it out right now... -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding environment variables to bash.
aditya shukla wrote: Can i add any environment variable to bash from my python script? so that when i use env command then i can see that environment variable. not if you run the script from the shell. when a process starts, it gets a *copy* of the parent's environment. it can modify that copy, but it cannot modify the variables in the parent. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
On Thu, 11 Sep 2008 03:36:35 -0500, Nick Craig-Wood wrote: As an ex-perl programmer and having used python for some years now, I'd type the explicit v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars Or maybe even v1 = mydict['one'] # 54 chars v2 = mydict['two'] v3 = mydict['two'] Either is only a couple more characters to type. But that's an accident of the name you have used. Consider: v1,v2,v3 = section_heading_to_table_index['one'], \ section_heading_to_table_index['two'], \ section_heading_to_table_index['two'] # 133 characters versus: v1,v2,v3 = [section_heading_to_table_index[k] for k in ['one','two','two']] # 75 characters It also fails the Don't Repeat Yourself principle, and it completely fails to scale beyond a handful of keys. Out of interest, on my PC at least the list comp version is significantly slower than the explicit assignments. So it is a micro-optimization that may be worth considering if needed -- but at the cost of harder to maintain code. It is completely explicit and comprehensible to everyone, in comparison to v1,v2,v3 = [ mydict[k] for k in ['one','two','two']] # 52 chars v1,v2,v3 = [ mydict[k] for k in 'one two two'.split()] # 54 chars That's a matter for argument. I find the list comprehension perfectly readable and comprehensible, and in fact I had to read your explicit assignments twice to be sure I hadn't missed something. But I accept that if you aren't used to list comps, they might look a little odd. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
On Thu, 11 Sep 2008 15:25:57 +1000, Ben Finney wrote: The bounce messages are sent to you because you sent the original. Wrong. I didn't send _any_ e-mail. Why should I get bounce messages? You asked for email to be sent, by sending a Usenet post to comp.lang.python. That's what a news-to-mail gateway does. I wasn't aware that comp.lang.python was a news-to-mail gateway. How can one tell the difference between news groups that use a news-to-mail gateway, and news groups that don't? Posting to a public newsgroup is obviously giving consent to forward that news posting to news clients. Given the ability to opt-out with the X-No- Archive header, there may even be an implied consent to allow archiving. But I don't believe there is any such implied consent to format-shift news messages to email. In practice, I couldn't care less what format my news postings are converted to, so long as it is invisible and transparent to me. If somebody wants to build a news-to-carved-in-giant-stone-tablets gateway, I don't care, so long as I don't get giant stone tablets aren't dumped in my front yard. Nor do I believe that by posting a news message I've automatically consented to receive email messages. To imply that the one implies the other is equivalent to arguing that because I've written a letter to the editor of a newspaper, I therefore must accept private correspondence from any person or corporation that has a subscription to that newspaper. (In practice, I don't mind human-generated email messages, but not automatic messages. If you can turn my munged email address into a real email address, I probably won't mind you emailing me. Don't abuse the privilege.) [...] I sympathise completely with your irritation at receiving bounce messages from poorly-configured software, but the solution is not to break the news-to-mail gateway. The correct solution is to unsubscribe the badly-behaving address from the mailing list, and refuse re-subscription from that address without assurance that the bad behaviour has ceased. The problem with that correct solution is that the party who suffers isn't in a position to correct the problem, and the party who can correct the problem has little incentive to do anything about it. That makes the solution ineffective and therefore anything but correct. I hope the person running the mailing list does do the right thing, but if he or she does, it will be an accident of policy or personality, and not because the system is robust and self-corrects errors. To quote Dennis Lee Bieber: The bounce/ooo-reply is sent to the message author, not to any intermediate host(s). After all, on that end, it's normal email failure response -- notify the author of the message. It doesn't matter that the original message was posted on a Usenet newsgroup if that group is automatically relayed to members of a mailing list. But that's wrong: it *shouldn't* be an normal email failure response, because the message author is in no position to do anything about it except to cease posting. That's a problem with all mailing lists (that I know of). -- Steven -- http://mail.python.org/mailman/listinfo/python-list
problem with interpreter
Hi ! I have Python installed on C:\Python25 Yesterday I added new wx library to the Python when I run C:\Python25\python.exe from the command line there is a problem with finding libraries: C:\Python25python.exe Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import wx Traceback (most recent call last): File stdin, line 1, in module File C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\__init__.py, line 45, in module from wx._core import * File C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\_core.py, line 5, in module import new File new.py, line 1 import ^ SyntaxError: invalid syntax / that problem doesn't exist when I run python.exe from different location (C:\, D:\) with python in the system path -- http://mail.python.org/mailman/listinfo/python-list
Is len O(n) or O(1) ?
Python uses arrays for lists right? def quicksort(lista): if lista == []: lista else: return quicksort([x for x in lista[1:] if x lista[0]]) + [lista[0]] + \ quicksort([x for x in lista[1:] if x = lista[0]]) or def quicksort(lista): if len(lista) == 0 lista else: return quicksort([x for x in lista[1:] if x lista[0]]) + [lista[0]] + \ quicksort([x for x in lista[1:] if x = lista[0]]) wait first one raises TypeError unsupported operand types. -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding environment variables to bash.
when a process starts, it gets a *copy* of the parent's environment. it can modify that copy, but it cannot modify the variables in the parent. You can make a command use the current shell though if you use the '.' command e.g.: jl cat env.sh export TEST='hello' jl ./env.sh env | grep TEST #Doesn't set TEST in parent shell jl . ./env.sh env | grep TEST #Adding '. ' before the command uses the same shell TEST=hello John. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is len O(n) or O(1) ?
process wrote: Python uses arrays for lists right? len is O(1). for other operations, see http://effbot.org/zone/python-list.htm#performance def quicksort(lista): if lista == []: lista better make that: def quicksort(lista): if not lista: return lista ... /F -- http://mail.python.org/mailman/listinfo/python-list
how dump a program which is running in memory
hi I have written a service running backgroud to do something in linux. unfortunately,I deleted the source code by mistake, and I can still see the process running background using ps aux : username 13820 0.0 0.0 60368 2964 ?SAug20 0:33 python ./UpdateJobStatus.py I wonder if there is some way to dump the programme UpdateJobStatus.py and get the source code back? Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is len O(n) or O(1) ?
On Thu, 11 Sep 2008 02:23:43 -0700, process wrote: Python uses arrays for lists right? `len()` on `list` objects is O(1). def quicksort(lista): if lista == []: lista else: return quicksort([x for x in lista[1:] if x lista[0]]) + [lista[0]] + \ quicksort([x for x in lista[1:] if x = lista[0]]) or def quicksort(lista): if len(lista) == 0 lista else: return quicksort([x for x in lista[1:] if x lista[0]]) + [lista[0]] + \ quicksort([x for x in lista[1:] if x = lista[0]]) wait first one raises TypeError unsupported operand types. Both do because `None` + `list` doesn't make sense. You should actually ``return`` the `lista` in the ``if`` branch instead of just lookup the object for that name and then do nothing with it. Shorter alternative: if not lista: return [] Empty lists are considered `False` in a boolean test. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding environment variables to bash.
John Lawrence wrote: You can make a command use the current shell though if you use the '.' command e.g.: jl cat env.sh export TEST='hello' jl ./env.sh env | grep TEST #Doesn't set TEST in parent shell jl . ./env.sh env | grep TEST #Adding '. ' before the command uses the same shell TEST=hello doesn't exactly work for Python scripts, though: $ cat env.py #!/usr/bin/env python import os os.environ[TEST] = hello $ . ./env.py env | grep TEST import: unable to open X server `'. bash: os.environ[TEST]: command not found /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
Steven D'Aprano wrote: I wasn't aware that comp.lang.python was a news-to-mail gateway. How can one tell the difference between news groups that use a news-to-mail gateway, and news groups that don't? by reading the group's FAQ, perhaps? http://www.faqs.org/faqs/python-faq/python-newsgroup-faq/ comp.lang.python (or c.l.py for short) is the general discussion newsgroup for users of the Python language. It is also available as a mailing list; see below for instructions on subscribing to c.l.py through the mailing list. it's been this way since the group was formed ~14 years ago, and isn't likely to change. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a SOAP module that can do this...?
On Sep 10, 9:44 pm, Waldemar Osuch [EMAIL PROTECTED] wrote: On Sep 10, 1:23 pm, thebjorn [EMAIL PROTECTED] wrote: I've been trying to use SOAPpy and ZSI (with and without the use of wsdl2py) to communicate with a SOAP server (looks like it's a WebLogic server(?) in front of some enterprise java bean) and not having much luck. I got them to send me an example of what the bytes on the wire are supposed to look like (attached below), and I got it to work by going lo-tech: If you are willing to go low tech you can tryhttp://effbot.org/downloads/#elementsoap But before you do that try:https://fedorahosted.org/suds It is actively maintained and holds a lot of promise. In my testing it knew how to connect to Sharepoint as well as WebLogic exposed services. Waldemar Thanks for the info Waldemar. I'm looking into suds now, but there's something I'm having trouble wrapping my head around (xml isn't my usual territory, so this is perhaps obvious to someone...) This is what suds tells me: print client suds ( version=0.2.9 ) service ( InboundLegacyDataService ) prefixes: ns0 = http://no/brreg/BReMS/WebService/services; methods (2): getInfo() submitMessage(xs:string cpaid, xs:string securityKey, xs:string message, ) types (4): submitMessage submitMessageResponse getInfo getInfoResponse The method I'm interested in is submitMessage and in particular the ``xs:string message`` parameter. I've been provided with three xsd files that I'm almost 100% sure defines the format of the xml in the message (it defines the JegerproveInn sub-structure), but it looks like that has to be wrapped in a SOAP:Envelope, including the ?xml.. declaration before being stuffed into the xs:string message parameter, before that in turn is wrapped in an env:Envelope... Am I on the right track? Another question: I'm assuming the xsd files can be used for more than documentation :-) I've found the w3schools Introduction to XML Schema which I'm starting to read right now, however I haven't been able to google up any Python-xsd thingy that looked promising (since I'm not sure what I'm looking for, this might not be a big surprise ;-) Is there such a thingy? Bjorn -- http://mail.python.org/mailman/listinfo/python-list
Extracing data from webpage
Hi, I am trying to download data from a webpage. I use mechanize python module. Could someone tell me how to set/pass an agent like Mozilla or IE that we do in perl's WWW::Mechanize?? Thanks, Srini Be the first one to try the new Messenger 9 Beta! Go to http://in.messenger.yahoo.com/win/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
Steven D'Aprano [EMAIL PROTECTED] writes: Nor do I believe that by posting a news message I've automatically consented to receive email messages. To imply that the one implies the other is equivalent to arguing that because I've written a letter to the editor of a newspaper, I therefore must accept private correspondence from any person or corporation that has a subscription to that newspaper. The two are not equivalent in this important detail: to post a newsgroup message, you must give a 'From' field in the header (note: just like email messages, newsgroup messages have exactly one header, comprised of multiple fields). You can fake an address in that field, of course, but it's considered bad form to do so. (That doesn't stop it being extremely common.) What you can't do is claim that, without express permission, no-one may send you an individual message to that address. On the contrary, that is the express purpose of the From field in a newsgroup message: to allow individual contact to the sender of the message. In the case of a letter to the editor a newspaper, the protocol is different. The newspapers are expected, by convention, to state the name and, often, suburb (or other location) of the writer; i.e. not enough information to send an individual message to the person. You might wish that Usenet operated the same in this respect, but it doesn't, and you can't reasonably expect that it does. -- \ “If you were going to shoot a mime, would you use a silencer?” | `\—Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic allocation file buffer
On 11 Sep, 10:34, Fredrik Lundh [EMAIL PROTECTED] wrote: And as I said before, the only use case for *huge* XML files I've ever seen used in practice is to store large streams of record-style data; I can imagine that the manipulation of the persistent form of large graph structures might be another use case, although for efficient navigation of such a structure, which is what you'd need to start applying various graph algorithms, one would need some kind of index. Certainly, we're straying into database territory. Paul -- http://mail.python.org/mailman/listinfo/python-list
Better error message on recursive import
Hi, why does Python only raise ImportError if it fails caused by a recursive import? I know what's wrong. But I guess many beginner don't know what's wrong. I don't want much, just RecursiveImportError instead of ImportError. Is this possible? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding environment variables to bash.
doesn't exactly work for Python scripts, though: True, but you can use it in the following (admittedly messy) way: jl cat setenv.sh /usr/bin/env python $@ . ./settmp rm settmp jl cat env.py #!/usr/bin/python command = export TEST='hello'\n open('settmp', 'w').write(command) jl . setenv.sh env.py env | grep TEST TEST=hello Note this won't set the environment variable until the end of the script, so if it's used in the script as well then it'll also need to be set with, for example, os.environ[TEST] = hello John. -- http://mail.python.org/mailman/listinfo/python-list
Re: Extracing data from webpage
On 11 Sep., 11:55, srinivasan srinivas [EMAIL PROTECTED] wrote: Hi, I am trying to download data from a webpage. I use mechanize python module. Could someone tell me how to set/pass an agent like Mozilla or IE that we do in perl's WWW::Mechanize?? Thanks, Srini http://wwwsearch.sourceforge.net/mechanize/doc.html Greetings, Uwe -- http://mail.python.org/mailman/listinfo/python-list
Re: Use Python to solve equations?
On 11 Sep., 09:09, Kelie [EMAIL PROTECTED] wrote: Hello group, Is there any packages in Python that will help me solve functions similar to this: x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? Thank you, Kelie look at www.sagemath.com . it is great. greetings, uwe -- http://mail.python.org/mailman/listinfo/python-list
Re: I want to use a C++ library from Python
On 10 Sep., 09:57, Anders Eriksson [EMAIL PROTECTED] wrote: Hello, I have a C++ library compiled as Windows DLL's. It consists of 32 .h and 1 .lib and 1 .dll files. I don't have the source code. How can I create a Python module from these files? Do you need the full library including classes or just some functions ? You could write a wrapper in C around the lib and use f2py or ctypes to call your wrapper from python. But that does not work if you want to expose classes. Greetings, Uwe -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing __slots__ from C
[ You can use the capi-sig for questions like this; see http://mail.python.org/mailman/listinfo/capi-sig ] Chris [EMAIL PROTECTED] writes: I'd like to be able to access an attribute of a particular Python object as fast as possible from some C code. I wondered if using __slots__ to store the attribute would allow me to do this in a faster way. The reason I'd like to do this is because I need to access the attribute inside a loop within some C code, and I find that the attribute lookup using the 'PyObject_GetAttrString' call is far slower than any of the subsequent calculations I perform in C. PyObject_GetAttrString is convenient, but it creates a Python string only so it can intern it (and in most cases throw away the freshly created version). For maximum efficiency, pre-create the string object using PyString_InternFromString, and use that with PyObject_GetAttr. -- http://mail.python.org/mailman/listinfo/python-list
Re: Persuading ConfigParser to give me the section elements in the same order as the file
Hi Matt, Have a look at this:http://www.python.org/dev/peps/pep-0372/ Thanks, that was very useful. Good to know these things are being considered. Looking at the config parser module, it looks like there are only a couple of places where {} is used. I would create a mixin class to replace the offending methods. That should work because it looks like you only have to replace __init__ and add_section. So... class OrderedConfigParserMixin: def __init__(self, defaults=None): self._sections = ndict.seqdict() self._defaults = ndict.seqdict() if defaults: for key, value in defaults.items(): self._defaults[self.optionxform(key)] = value def add_section(self, section): Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. if section in self._sections: raise DuplicateSectionError(section) self._sections[section] = ndict.seqdict() # Then you can use this to create your own ordered config parsers. Note that # multiple inheritance in python uses a breadth first search. If you want # the methods on your mixin to get called instead of the methods on the # original class you must include the mixin first. from ConfigParser import RawConfigParser, ConfigParser, SafeConfigParser class OrderedRawConfigParser(OrderedConfigParserMixin, RawConfigParser): pass class OrderedConfigParser(OrderedConfigParserMixin, ConfigParser): pass class OrderedSafeConfigParser(OrderedConfigParserMixin, SafeConfigParser): pass I don't know if this is the _best_ approach, but it is certainly much preferred over monkey patching the built-ins module. Note that I haven't tested any of the above code. Yes, I tried this first. But actually you missed the main place where dictionaries are created, which is the monster method _read, the line being cursect = {'__name__': sectname} I thought by the time I'd copied that whole method just to edit that line I may as well just copy the whole file and forget the inheritance :) btw, the PEP you pointed me at indicated ConfigParser will take a dict_type argument for exactly this purpose in Python 2.6, so I look forward to when I can use that instead... Regards, Geoff -- http://mail.python.org/mailman/listinfo/python-list
Re: how dump a program which is running in memory
ruqiang826 wrote: hi I have written a service running backgroud to do something in linux. unfortunately,I deleted the source code by mistake, and I can still see the process running background using ps aux : username 13820 0.0 0.0 60368 2964 ?SAug20 0:33 python ./UpdateJobStatus.py I wonder if there is some way to dump the programme UpdateJobStatus.py and get the source code back? Often, there is a way by accessing /proc/{pid}/fd/ But I believe you're out of luck with this method because apparently the Python interpreter closes the source file after parsing it. You can still try to find an undeletion utility for your filesystem. Avoid writing to disk in the meantime to not overwrite the deleted file accidentally, of course. There's such a utility for ext2, but I don't know if that works ok with ext3. For other filesystems, I have no idea. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Extracing data from webpage
On Sep 11, 11:55 am, srinivasan srinivas [EMAIL PROTECTED] wrote: Hi, I am trying to download data from a webpage. I use mechanize python module. Could someone tell me how to set/pass an agent like Mozilla or IE that we do in perl's WWW::Mechanize?? Thanks, Srini Be the first one to try the new Messenger 9 Beta! Go tohttp://in.messenger.yahoo.com/win/ If you have to parse a web page, this could be also useful: http://www.crummy.com/software/BeautifulSoup/ -- http://mail.python.org/mailman/listinfo/python-list
Re: formating a filesystem with python
Ricardo Tiago [EMAIL PROTECTED] wrote: is there a package in python that allows to mount/umount and format (to ext3) a filesystem? I know that this is possible by just calling the os commands 'mount/umount and mkfs' but this would imply to have to change sudoers to run the script as non-root. On Linux (I guess thats the target OS as you mentioned ext3) mounting could be done as non-root using FUSE or HAL (maybe using a frontend like gio or kio) if the system supports that, or with an appropriate fstab entry. Maybe HAL can configured to do mkfs but that has to be done very carefully to avoid security problems. Maybe you could use something like AppArmor, too. Most likely you get better answers by first asking in a Linux group how to do this things without root privileges and then come back to ask how to do it with Python. Florian -- http://www.florian-diesch.de/ --- ** Hi! I'm a signature virus! Copy me into your signature, please! ** --- -- http://mail.python.org/mailman/listinfo/python-list
RE: removing text string
Thanks Actually the number I am getting it is from slicing from a long text line. I need to slice 10 characters from that line but no string only numeric numbers. When I am slicing 10 characters those A, c, O is coming at the end. Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Lee Bieber Sent: Wednesday, September 10, 2008 3:45 PM To: python-list@python.org Subject: Re: removing text string On Wed, 10 Sep 2008 11:22:16 -0400, Ahmed, Shakir [EMAIL PROTECTED] declaimed the following in comp.lang.python: I need to remove text string from the list of the numbers mentioned below: 080829-7_A 070529-5_c 080824-7_O 070405_6_p ? Is that last one an error that is supposed to be ...5-6_, not ...5_6_ ? 1) If the required data is fixed width, just slice it out = inp[:8] 2) If the data is variable width but has a fixed delimiter, find the delimiter position and then slice (this is the reason for my question above -- this method) OR just split on the delimiter and take the part you need. out = inp.split(_)[0] 3) If the data is more complex (again if that last line with two _ is supposed to be trimmed after the second, and the first turned into a -) you will need to fully define the parsing rules of the data. -- WulfraedDennis Lee Bieber KD6MOG [EMAIL PROTECTED] [EMAIL PROTECTED] HTTP://wlfraed.home.netcom.com/ (Bestiaria Support Staff: [EMAIL PROTECTED]) HTTP://www.bestiaria.com/ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with interpreter
chusky wrote: File C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\_core.py, line 5, in module import new File new.py, line 1 import ^ SyntaxError: invalid syntax wxPython tries to import the module new from Python's standard library, but picks up a broken module named new.py from your development directory instead. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with interpreter
chusky wrote: Hi ! I have Python installed on C:\Python25 Yesterday I added new wx library to the Python when I run C:\Python25\python.exe from the command line there is a problem with finding libraries: C:\Python25python.exe Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import wx Traceback (most recent call last): File stdin, line 1, in module File C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\__init__.py, line 45, in module from wx._core import * File C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\_core.py, line 5, in module import new File new.py, line 1 import ^ SyntaxError: invalid syntax / that problem doesn't exist when I run python.exe from different location (C:\, D:\) with python in the system path Do you by any chance have a file new.py, or new.pyc lying around? It's always a bad idea to name your own modules after standard-modules (new is a standard-module), as they might get picked up first. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: how dump a program which is running in memory
On Thu, 11 Sep 2008 02:31:23 -0700 (PDT), ruqiang826 wrote: I have written a service running backgroud to do something in linux. unfortunately$B!$(BI deleted the source code by mistake, and I can still see the process running background using ps aux : username 13820 0.0 0.0 60368 2964 ?SAug20 0:33 python ./UpdateJobStatus.py I wonder if there is some way to dump the programme UpdateJobStatus.py and get the source code back? The best way to do it would be to undelete the file, just as Gerhard suggested. If you remember any line (or piece) of code from the UpdateJobStatus.py file you can try to dump the /dev/mem to the hard disk, and then grep through it (remember that you need root priviledges to access /dev/mem). I tried it with this code: http://www.mail-archive.com/[EMAIL PROTECTED]/msg03696.html with a small modification of this line: nvram = (strtol(argv[1], 0, 0)) 16; changed to: nvram = (strtol(argv[1], 0, 0)); After compilation I just did: ./a.out 0x0 0x memdump to get the memory dump. I am not a memory expert, but 0x should be enough for = 4GB of RAM. If you got more, increase it. And to make it clear: I do not recommend this way of sorting things out :) -- Regards, Wojtek Walczak, http://tosh.pl/gminick/ -- http://mail.python.org/mailman/listinfo/python-list
Re: function return
Beema Shafreen wrote: I have a script using functions , I have a problem in returning the result. My script returns only one line , i donot know where the looping is giving problem, Can any one suggest, why this is happening and let me know how to return all the lines def get_ptm(): fh = open('file.txt','r') data_lis = [] for line in fh.readlines(): data = line.strip().split('\t') id = data[0].strip() gene_symbol = data[1].strip() ptms = data[8].strip() result = %s\t%s\t%s %(id,gene_symbol,ptms) return result note that you put the return statement inside the loop, so returning only one line is the expected behaviour. result = %s\t%s\t%s %(id,gene_symbol,ptms) data_lis.append(result) and then return the list when done: fh.close() return data_lis ::: if you change the original return to yield, the function will turn into a generator that yields one result at a time. result = %s\t%s\t%s %(id,gene_symbol,ptms) yield result for more on generators, and how they are used, see the documentation. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: function return
make that: note that you put the return statement inside the loop, so returning only one line is the expected behaviour. to fix this, you can append the result strings to the data_lis list inside the loop: result = %s\t%s\t%s %(id,gene_symbol,ptms) data_lis.append(result) and then return the list when done: fh.close() return data_lis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Open Office
On Sep 11, 7:04 am, Colin J. Williams [EMAIL PROTECTED] wrote: Marco Bizzarri wrote: On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom [EMAIL PROTECTED] wrote: Hello, I would like to create and manipulate Open Office documents using Python. I have found then UNO Python page and odfpy modules which seem to be exactly what I need. The odfpy manual is, to me, a confusing list of objects and methods (it's an impressive list!), but does not have much in the way of how to use them. For example, I can open a spreadsheet and create new pages (there's a nice example near the back of the manual) but I can't figure out how to open an existing spreadsheet and list the names of the individual sheets (tabs). I have written an application that access Microsoft Excel and creates reports for work, but would like to create an Open Source version using Open Office and release it to the community (and maybe get a talk at PyCon :-). Is there someone here who can help me out, or is there an appropriate mailing list for me to join? Ciao, Greg. you should check with the openoffice.org mailing list; I think what you are looking for is the api mailing list for openoffice; you could try to get the OpenOffice.org developers guide and the SDK, and check it (but it is not a little work) Regards Marco Thanks --greg -- http://mail.python.org/mailman/listinfo/python-list Greg, If you follow this up, I hope that you will post info to c.l.p and let us know whether the UNO interface is Python 2.5 compatible. The last time I looked it was set for 2.3 or 2.4. Colin W I've recently been working on interfacing with OpenOffice via UNO with Python. I can confirm that unfortunately, the PyUNO interface presently (OpenOffice 2.4) is built with Python 2.3... so to use the UNO interface from Python you have to write a separate script to run in the OpenOffice Python 2.3 environment. Apparently someone is working on rebuilding the PyUNO library for Python 2.5 but there's no timeframe for when that might be included with the OpenOffice distribution. You could try building PyUNO with Python 2.5 yourself, I'm sure I came across instructions somewhere on the OpenOffice developer website... I've not used odfpy so don't know how it compares in terms of degree of difficulty to UNO. -- http://mail.python.org/mailman/listinfo/python-list
RE: removing text string
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, September 11, 2008 8:54 AM To: python-list@python.org Subject: Re: removing text string Ahmed, Shakir: Actually the number I am getting it is from slicing from a long text line. I need to slice 10 characters from that line but no string only numeric numbers. When I am slicing 10 characters those A, c, O is coming at the end. It's better to avoid Regular expressions when they aren't necessary, but once in a while they are the simpler way to solve a problem, you may create one like this (mostly untested): \d+?-\d+ Using it like: import re patt = re.compile(r\d+?-\d+) patt.search(xx080829-7_A ).group() '080829-7' re.search(r\d+?-\d+, xx080829-7_A ).group() '080829-7' Learning Regexps can be useful. Bye, Bearophile Thanks, I got the clue. Very much appreciated. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
catching exceptions from fortran
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # grid is a wrapped fortran module # no runtime errors incurred when run with the correct inputs for filetype #--- def readGrid( self, coord='xyz' ): mg = ( '.FALSE.', '.TRUE.' ) form = ( 'FORMATTED', 'UNFORMATTED' ) success = False for m in mg: for f in form: try: if coord == 'xyz': self.grid.readxyz( self.filename, f, m ) success = True elif coord == 'xyrb': self.grid.readxyrb( self.filename, f, m ) success = True else: import sys print 'gridtype ' + str(coord) + ' not supported. ' \ + 'IO.Plot3d.Plot3d.read' except: continue if not success: import sys print 'gridfile ' + str(self.filename) + ' not read in any recognized format' \ + ' IO.Plot3d.Plot3d.read' # basically, what i want to happen is to try to run 'something' with the wrapped fortran code and if that doesn't work (error encountered, etc.) try something else. is there an easier way to go about doing this? is there something i'm missing about catching exceptions here? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list
Re: NumPy arrays that use memory allocated from other libraries or tools
sturlamolden wrote: On Sep 10, 6:39 am, Travis Oliphant [EMAIL PROTECTED] wrote: I wanted to point anybody interested to a blog post that describes a useful pattern for having a NumPy array that points to the memory created by a different memory manager than the standard one used by NumPy. Here is something similar I have found useful: There will be a new module in the standard library called 'multiprocessing' (cf. the pyprocessing package in cheese shop). It allows you to crerate multiple processes (as opposed to threads) for concurrency on SMPs (cf. the dreaded GIL). The 'multiprocessing' module let us put ctypes objects in shared memory segments (processing.Array and processing.Value). It has it's own malloc, so there is no 4k (one page) lower limit on object size. Here is how we can make a NumPy ndarray view the shared memory referencey be these objects: try: import processing except: import multiprocessing as processing import numpy, ctypes _ctypes_to_numpy = { ctypes.c_char : numpy.int8, ctypes.c_wchar : numpy.int16, ctypes.c_byte : numpy.int8, ctypes.c_ubyte : numpy.uint8, ctypes.c_short : numpy.int16, ctypes.c_ushort : numpy.uint16, ctypes.c_int : numpy.int32, ctypes.c_uint : numpy.int32, ctypes.c_long : numpy.int32, ctypes.c_ulong : numpy.int32, ctypes.c_float : numpy.float32, ctypes.c_double : numpy.float64 } def shmem_as_ndarray( array_or_value ): view processing.Array or processing.Value as ndarray obj = array_or_value._obj buf = obj._wrapper.getView() try: t = _ctypes_to_numpy[type(obj)] return numpy.frombuffer(buf, dtype=t, count=1) except KeyError: t = _ctypes_to_numpy[obj._type_] return numpy.frombuffer(buf, dtype=t) With this simple tool we can make processes created by multiprocessing work with ndarrays that reference the same shared memory segment. I'm doing some scalability testing on this. It looks promising :) Hey, that is very neat. Thanks for pointing me to it. I was not aware of this development in multiprocessing. -Travis -- http://mail.python.org/mailman/listinfo/python-list
Re: function return
thanks for your valuable comments. I could solve the problem wiht your comments On Thu, Sep 11, 2008 at 7:07 PM, Fredrik Lundh [EMAIL PROTECTED]wrote: make that: note that you put the return statement inside the loop, so returning only one line is the expected behaviour. to fix this, you can append the result strings to the data_lis list inside the loop: result = %s\t%s\t%s %(id,gene_symbol,ptms) data_lis.append(result) and then return the list when done: fh.close() return data_lis -- http://mail.python.org/mailman/listinfo/python-list -- Beema Shafreen -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Open Office
Greg, as an addition to what I already said to you, you can consider taking a look at oood from ERP5 project http://wiki.erp5.org/HowToUseOood OOOd (openoffice.org daemon) runs openoffice behind the scene, and allows you to interact with it via XML-RPC; it should be quite robust, since it is actively mantained and used in a big software project. And, also, it should be quite easy to extend in order to have your custom functions run via XML-RPC. Regards Marco -- Marco Bizzarri http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: function return
Beema Shafreen wrote: hi all, I have a script using functions , I have a problem in returning the result. My script returns only one line , i donot know where the looping is giving problem, Can any one suggest, why this is happening and let me know how to return all the lines def get_ptm(): fh = open('file.txt','r') data_lis = [] for line in fh.readlines(): As an aside, you should change the above line to: for line in fh: readlines() will read the entire file into memory at once, while just iterating through it won't, so you'll save memory on large files. data = line.strip().split('\t') id = data[0].strip() gene_symbol = data[1].strip() ptms = data[8].strip() result = %s\t%s\t%s %(id,gene_symbol,ptms) This is very trivial, but you could change the above line to: result = \t.join(id, gene_symbol, ptms) return result fh.close() -- -- http://mail.python.org/mailman/listinfo/python-list
Python platform.
Hello all; I wonder if there is a platform written in python. The equivalent of the Netbeans platform http://platform.netbeans.org/ in the Python world. Do you know such a thing? Thanks a lot. Jonathan. -- http://mail.python.org/mailman/listinfo/python-list
huge socket recv speed discrepancy between different OSs
Do you see this too? Mor information and testcase here: http://bugs.python.org/issue3766 I would also be interested in the profiler output under windows. All the best Thorben -- http://mail.python.org/mailman/listinfo/python-list
Re: Python platform.
[EMAIL PROTECTED] wrote: I wonder if there is a platform written in python. The equivalent of the Netbeans platform http://platform.netbeans.org/ in the Python world. Do you know such a thing? You (or maybe the Java folks) seem to have missed that platform has a rather specific meaning in computing: http://en.wikipedia.org/wiki/Platform_(computing) Given that definition, Python is pretty much a platform in itself. If you want to use Python for a specific task, you add libraries for that task. Tell us what you want to do, and we'll tell you what libraries and toolkits you might want to try. /F -- http://mail.python.org/mailman/listinfo/python-list
Enumerating ordered expat attributes with tuplets?
Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in order when the file is written out (so I can check my results with a diff tool) I've set the parser's ordered_attributes attribute. But this has stopped the for loop working with the tuplets. The relevant bit of code in my little test, using the default Dictionary for the attributes, is: def start_element(name, attrs): print %s : % name, for (a,b) in attrs.items(): print %s=\%s\ % (a,b), But when I set ordered_attributes, first it doesn't like the items() AttributeError: 'list' object has no attribute 'items' And then it doesn't like the tuple ValueError: too many values to unpack Do I have keep track of where I am (name, value, name, value, ...) Or is there a way I can solve the problem with a tuple? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
On 2008-09-11, Steven D'Aprano [EMAIL PROTECTED] wrote: On Thu, 11 Sep 2008 15:25:57 +1000, Ben Finney wrote: The bounce messages are sent to you because you sent the original. Wrong. I didn't send _any_ e-mail. Why should I get bounce messages? You asked for email to be sent, No, I didn't. by sending a Usenet post to comp.lang.python. That's what a news-to-mail gateway does. ROTFL. That's like saying: you asked to be mugged by walking down a street where there was a mugger. That's what a mugger does. I wasn't aware that comp.lang.python was a news-to-mail gateway. How can one tell the difference between news groups that use a news-to-mail gateway, and news groups that don't? One can't tell. Posting to a public newsgroup is obviously giving consent to forward that news posting to news clients. Given the ability to opt-out with the X-No- Archive header, there may even be an implied consent to allow archiving. But I don't believe there is any such implied consent to format-shift news messages to email. I certainly don't care if the articles I post are sent to anybody via any transport. I just don't like it being made to appear that I'm the one who sent them. I supposed I could break down and stop using my real e-mail address in the From: field. Or I could add some procmail rules to try to filter out the results of being joe-jobbed by the gateway. In practice, I couldn't care less what format my news postings are converted to, so long as it is invisible and transparent to me. That's the issue: it's not invisible to you if you're getting bounce messages, out-of-office-replies, and other e-mail traffic generated by the fact the somebody is grabbing articles off Usenet and mailing them out as if it were you that sent them. If somebody wants to build a news-to-carved-in-giant-stone-tablets gateway, I don't care, so long as I don't get giant stone tablets aren't dumped in my front yard. Nor do I believe that by posting a news message I've automatically consented to receive email messages. To imply that the one implies the other is equivalent to arguing that because I've written a letter to the editor of a newspaper, I therefore must accept private correspondence from any person or corporation that has a subscription to that newspaper. (In practice, I don't mind human-generated email messages, but not automatic messages. If you can turn my munged email address into a real email address, I probably won't mind you emailing me. Don't abuse the privilege.) I don't mind receiving private e-mails from people who recieved the posting (either via Usenet or the gatewayed mailing list). If I did, I wouldn't use my real e-mail address. But, I don't want to receive machined generated trash or to be cc'd by people following up to the article. The bounce/ooo-reply is sent to the message author, not to any intermediate host(s). After all, on that end, it's normal email failure response -- notify the author of the message. It doesn't matter that the original message was posted on a Usenet newsgroup if that group is automatically relayed to members of a mailing list. But that's wrong: it *shouldn't* be an normal email failure response, because the message author is in no position to do anything about it except to cease posting. That's a problem with all mailing lists (that I know of). I know of other mailing lists aren't configured that way: the original author doesn't get bounce messages -- the sender of the bounced e-mail gets the bounce message. -- Grant Edwards grante Yow! Clear the laundromat!! at This whirl-o-matic just had visi.coma nuclear meltdown!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating ordered expat attributes with tuplets?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Andy, by the looks of it I'd say that the problem is that the second parameter you passed to start_element is not a dictionary at all (the clue is in the AttributeError: 'LIST' object ...). d = ['tree', 'house'] start_element(Thing, d) Thing : AttributeError: 'list' object has no attribute 'items' d = {'tree': 'hug', 'flower' : 'eat'} start_element(Thing, d) Thing : flower=eat tree=hug Manuel On Sep 11, 2008, at 4:21 PM, [EMAIL PROTECTED] wrote: Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in order when the file is written out (so I can check my results with a diff tool) I've set the parser's ordered_attributes attribute. But this has stopped the for loop working with the tuplets. The relevant bit of code in my little test, using the default Dictionary for the attributes, is: def start_element(name, attrs): print %s : % name, for (a,b) in attrs.items(): print %s=\%s\ % (a,b), But when I set ordered_attributes, first it doesn't like the items() AttributeError: 'list' object has no attribute 'items' And then it doesn't like the tuple ValueError: too many values to unpack Do I have keep track of where I am (name, value, name, value, ...) Or is there a way I can solve the problem with a tuple? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFIyTOLcZ70OCIgLecRAsBrAJ9YSa7f+YTyM1yRmEKw8KBtb2klIgCgjNzw F295Tik+45eNHnJ3B4kKnWU= =xR4m -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Python platform.
On Sep 11, 4:19 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I wonder if there is a platform written in python. The equivalent of the Netbeans platformhttp://platform.netbeans.org/in the Python world. Do you know such a thing? You (or maybe the Java folks) seem to have missed that platform has a rather specific meaning in computing: http://en.wikipedia.org/wiki/Platform_(computing) Given that definition, Python is pretty much a platform in itself. If you want to use Python for a specific task, you add libraries for that task. Tell us what you want to do, and we'll tell you what libraries and toolkits you might want to try. /F I want to build a desktop application. I am searching for some kind of environment that would provide all the elements ready (Windows...). Then I would have to code the business logic only. Jonathan. -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating ordered expat attributes with tuplets?
On Sep 11, 4:04 pm, Manuel Ebert [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Andy, by the looks of it I'd say that the problem is that the second parameter you passed to start_element is not a dictionary at all (the clue is in the AttributeError: 'LIST' object ...). d = ['tree', 'house'] start_element(Thing, d) Thing : AttributeError: 'list' object has no attribute 'items' d = {'tree': 'hug', 'flower' : 'eat'} start_element(Thing, d) Thing : flower=eat tree=hug Manuel On Sep 11, 2008, at 4:21 PM, [EMAIL PROTECTED] wrote: Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in order when the file is written out (so I can check my results with a diff tool) I've set the parser's ordered_attributes attribute. But this has stopped the for loop working with the tuplets. The relevant bit of code in my little test, using the default Dictionary for the attributes, is: def start_element(name, attrs): print %s : % name, for (a,b) in attrs.items(): print %s=\%s\ % (a,b), But when I set ordered_attributes, first it doesn't like the items() AttributeError: 'list' object has no attribute 'items' And then it doesn't like the tuple ValueError: too many values to unpack Do I have keep track of where I am (name, value, name, value, ...) Or is there a way I can solve the problem with a tuple? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFIyTOLcZ70OCIgLecRAsBrAJ9YSa7f+YTyM1yRmEKw8KBtb2klIgCgjNzw F295Tik+45eNHnJ3B4kKnWU= =xR4m -END PGP SIGNATURE-- Hide quoted text - - Show quoted text - Sorry! I forgot to mention that when you set the parser's ordered_attributes attribute, it sends the attrs to start_element as a list, not a dictionary, in the order name, value, name, value, ... Andy -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
Grant Edwards [EMAIL PROTECTED] writes: Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages? While you're at it, might as well fix it for everybody else too. ;) Its a bit rude to send out mass e-mail messages with headers faked up so that the bounce messages go to somebody else. Messages you submit to the newsgroup are forwarded to the mailing list. When mail messages bounce, the MTA (Message Transfer Agent--the program that handles mail) *should* send the bounce message to whatever is in the Sender header, and only if that header does not exist, should it use the From header. Messages forwarded by the gateway get a Sender header which points back to the gateway. In other words, if a message gets bounced back to the From address, the MTA does it incorrectly. There is nothing the list administrator can do about it. You can try complaining to the postmaster of the bouncing system, but that's about it. In other words, your question in the first paragraph is already implemented and was implemented from the beginning. It is not the gateway's fault that there are systems that don't follow the standards. -- Sjoerd Mullender, python-list administrator -- http://mail.python.org/mailman/listinfo/python-list
Re: emulating read and readline methods
On Sep 11, 9:23 am, Sean Davis [EMAIL PROTECTED] wrote: On Sep 10, 7:54 pm, John Machin [EMAIL PROTECTED] wrote: On Sep 11, 8:01 am, MRAB [EMAIL PROTECTED] wrote: On Sep 10, 6:59 pm, Sean Davis [EMAIL PROTECTED] wrote: I have a large file that I would like to transform and then feed to a function (psycopg2 copy_from) that expects a file-like object (needs read and readline methods). I have a class like so: class GeneInfo(): def __init__(self): #urllib.urlretrieve('ftp://ftp.ncbi.nih.gov/gene/DATA/ gene_info.gz',/tmp/gene_info.gz) self.fh = gzip.open(/tmp/gene_info.gz) self.fh.readline() #deal with header line def _read(self,n=1): for line in self.fh: if line=='': break line=line.strip() line=re.sub(\t-,\t,line) rowvals = line.split(\t) yield \t.join([rowvals[i] for i in [0,1,2,3,6,7,8,9,10,11,12,14]]) + \n def readline(self,n=1): return self._read().next() def read(self,n=1): return self._read().next() Each time readline() and read() call self._read() they are creating a new generator. They then get one value from the newly-created generator and then discard that generator. What you should do is create the generator in __init__ and then use it in readline() and read(). def close(self): self.fh.close() and I use it like so: a=GeneInfo() cur.copy_from(a,gene_info) a.close() It works well except that the end of file is not caught by copy_from. I get errors like: psycopg2.extensions.QueryCanceledError: COPY from stdin failed: error during .read() call CONTEXT: COPY gene_info, line 1000: for a 1000 line test file. Any ideas what is going on? I wonder whether it's expecting readline() and read() to return an empty string at the end of the file instead of raising StopIteration. Don't wonder; ReadTheFantasticManual: read( [size]) ... An empty string is returned when EOF is encountered immediately. ... readline( [size]) ... An empty string is returned only when EOF is encountered immediately. Thanks. This was indeed my problem--not reading the manual closely enough. And the points about the iterator being re-instantiated were also right on point. Interestingly, in this case, the code was working because read() and readline() were still returning the next line each time since the file handle was being read one line at a time. After further thought, do you actually need a generator? read() and readline() could just call _read(), which would read a line from the file and return the result or an empty string. Or the processing could be done in readline() and read() just could call readline(). -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating ordered expat attributes with tuplets?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ah, well. Don't know whether it meets your aesthetic standards, but: my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] my_list[0:len(a):2] ['tree', 'flower', 'bear'] my_list[1:len(a):2] ['hug', 'hug', 'run'] and hence zip(my_list[0:len(a):2], my_list[1:len(a):2]) [('tree', 'hug'), ('flower', 'hug'), ('bear', 'run')] and furthermore for a, b in zip(my_list[0:len(a):2], my_list[1:len(a):2]): ... print a, b ... tree hug flower hug bear run or the slightly less obfuscated: for index in range(0, len(my_list), 2): ... print my_list[index], my_list[index + 1] ... tree hug flower hug bear run On Sep 11, 2008, at 5:19 PM, [EMAIL PROTECTED] wrote: On Sep 11, 4:04 pm, Manuel Ebert [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Andy, by the looks of it I'd say that the problem is that the second parameter you passed to start_element is not a dictionary at all (the clue is in the AttributeError: 'LIST' object ...). d = ['tree', 'house'] start_element(Thing, d) Thing : AttributeError: 'list' object has no attribute 'items' d = {'tree': 'hug', 'flower' : 'eat'} start_element(Thing, d) Thing : flower=eat tree=hug Manuel On Sep 11, 2008, at 4:21 PM, [EMAIL PROTECTED] wrote: Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in order when the file is written out (so I can check my results with a diff tool) I've set the parser's ordered_attributes attribute. But this has stopped the for loop working with the tuplets. The relevant bit of code in my little test, using the default Dictionary for the attributes, is: def start_element(name, attrs): print %s : % name, for (a,b) in attrs.items(): print %s=\%s\ % (a,b), But when I set ordered_attributes, first it doesn't like the items() AttributeError: 'list' object has no attribute 'items' And then it doesn't like the tuple ValueError: too many values to unpack Do I have keep track of where I am (name, value, name, value, ...) Or is there a way I can solve the problem with a tuple? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFIyTOLcZ70OCIgLecRAsBrAJ9YSa7f+YTyM1yRmEKw8KBtb2klIgCgjNzw F295Tik+45eNHnJ3B4kKnWU= =xR4m -END PGP SIGNATURE-- Hide quoted text - - Show quoted text - Sorry! I forgot to mention that when you set the parser's ordered_attributes attribute, it sends the attrs to start_element as a list, not a dictionary, in the order name, value, name, value, ... Andy -- http://mail.python.org/mailman/listinfo/python-list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFIyT25cZ70OCIgLecRAmWqAJ4zEy8gatIh4CqKpJxZwACs9BBxgwCfaPoQ QfmRVzHqwJFu3WnjCM0TJYo= =9z6U -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
Thanks a lot for all your answers. There's quite some things I learnt :-) [v1,v2,v3] = ... can be typed as v1,v2,v3 = . . . I also wasn't used to map(myhash.get, ['one', 'two', 'two']) itemgetter('one', 'one', 'two')(x) I also didn't know print %(one)s\n%(two)s\n%(two)s % mydict The reason I'd like to have a short statement for above is, that this is for me basically just some code, to name and use certain fields of a hash in i given code section. The real example would be more like: name,age,country = itemgetter('name age country'.split())(x) # or any of my above versions # a lot of code using name / age / country thanks a gain and bye H On Sep 10, 5:28 pm, hofer [EMAIL PROTECTED] wrote: Let's take following perl code snippet: %myhash=( one = 1 , two = 2 , three = 3 ); ($v1,$v2,$v3) = @myhash{qw(one two two)}; # -- line of interest print $v1\n$v2\n$v2\n; How do I translate the second line in a similiar compact way to python? Below is what I tried. I'm just interested in something more compact. mydict={ 'one' : 1 , 'two' : 2 , 'three' : 3 } # first idea, but still a little too much to type [v1,v2,v3] = [ mydict[k] for k in ['one','two','two']] # for long lists lazier typing,but more computational intensive # as split will probably be performed at runtime and not compilation time [v1,v2,v3] = [ mydict[k] for k in 'one two two'.split()] print %s\n%s\n%s %(v1,v2,v3) -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
On Sep 11, 10:36 am, Nick Craig-Wood [EMAIL PROTECTED] wrote: I'd type the explicit v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars Either is only a couple more characters to type. It is completely explicit and comprehensible to everyone, in comparison to v1,v2,v3 = [ mydict[k] for k in ['one','two','two']] # 52 chars v1,v2,v3 = [ mydict[k] for k in 'one two two'.split()] # 54 chars Unlike perl, it will also blow up if mydict doesn't contain 'one' which may or may not be what you want. Is your above solution robust against undefined keys. In my example it would'nt be a problem. The dict would be fully populated, but I'm just curious. -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating ordered expat attributes with tuplets?
On Sep 11, 4:48 pm, Manuel Ebert [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ah, well. Don't know whether it meets your aesthetic standards, but: my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] my_list[0:len(a):2] ['tree', 'flower', 'bear'] my_list[1:len(a):2] ['hug', 'hug', 'run'] and hence zip(my_list[0:len(a):2], my_list[1:len(a):2]) [('tree', 'hug'), ('flower', 'hug'), ('bear', 'run')] and furthermore for a, b in zip(my_list[0:len(a):2], my_list[1:len(a):2]): ... print a, b ... tree hug flower hug bear run or the slightly less obfuscated: for index in range(0, len(my_list), 2): ... print my_list[index], my_list[index + 1] ... tree hug flower hug bear run On Sep 11, 2008, at 5:19 PM, [EMAIL PROTECTED] wrote: On Sep 11, 4:04 pm, Manuel Ebert [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Andy, by the looks of it I'd say that the problem is that the second parameter you passed to start_element is not a dictionary at all (the clue is in the AttributeError: 'LIST' object ...). d = ['tree', 'house'] start_element(Thing, d) Thing : AttributeError: 'list' object has no attribute 'items' d = {'tree': 'hug', 'flower' : 'eat'} start_element(Thing, d) Thing : flower=eat tree=hug Manuel On Sep 11, 2008, at 4:21 PM, [EMAIL PROTECTED] wrote: Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in order when the file is written out (so I can check my results with a diff tool) I've set the parser's ordered_attributes attribute. But this has stopped the for loop working with the tuplets. The relevant bit of code in my little test, using the default Dictionary for the attributes, is: def start_element(name, attrs): print %s : % name, for (a,b) in attrs.items(): print %s=\%s\ % (a,b), But when I set ordered_attributes, first it doesn't like the items() AttributeError: 'list' object has no attribute 'items' And then it doesn't like the tuple ValueError: too many values to unpack Do I have keep track of where I am (name, value, name, value, ...) Or is there a way I can solve the problem with a tuple? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFIyTOLcZ70OCIgLecRAsBrAJ9YSa7f+YTyM1yRmEKw8KBtb2klIgCgjNzw F295Tik+45eNHnJ3B4kKnWU= =xR4m -END PGP SIGNATURE-- Hide quoted text - - Show quoted text - Sorry! I forgot to mention that when you set the parser's ordered_attributes attribute, it sends the attrs to start_element as a list, not a dictionary, in the order name, value, name, value, ... Andy -- http://mail.python.org/mailman/listinfo/python-list -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFIyT25cZ70OCIgLecRAmWqAJ4zEy8gatIh4CqKpJxZwACs9BBxgwCfaPoQ QfmRVzHqwJFu3WnjCM0TJYo= =9z6U -END PGP SIGNATURE-- Hide quoted text - - Show quoted text - Thanks! Regarding aesthetics - I don't need it to look pretty: I want it to be understandable to people who know Python (?), and then as efficient as possible. Of the two examples about (the 'zip' solution and the 'range' solution), is there much difference in performance? Andy -- http://mail.python.org/mailman/listinfo/python-list
Re: Better error message on recursive import
On Thu, 11 Sep 2008 12:43:34 +0200, Thomas Guettler wrote: why does Python only raise ImportError if it fails caused by a recursive import? I know what's wrong. But I guess many beginner don't know what's wrong. I don't want much, just RecursiveImportError instead of ImportError. Is this possible? Can you give an example of such a recursive import you want the special exception be raised? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
hofer: The real example would be more like: name,age,country = itemgetter('name age country'.split())(x) # or any of my above versions That solution is very clever, and the inventor smart, but it's too much out of standard and complex to be used in normal real code. Learning tricks is useful, but then in real code you have to use then only once in a while. A list comp is quite more easy to understand for Python programmers. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
On 2008-09-11, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 10 Sep 2008 21:36:36 -0500, Grant Edwards [EMAIL PROTECTED] declaimed the following in comp.lang.python: Wrong. I didn't send _any_ e-mail. Why should I get bounce messages? One: Comp.lang.python is dual-routed with a mailing list; anything you post to either CLP or the mailing list gets cross-posted to the other -- the FROM header retains that of the original author (which could be you). Two: Somebody else is subscribed to the mailing list, and sets up an out-of-office reply or has other problems (like an overfilled mailbox, causing a bounce, or a discontinued account) when the forwarded post reaches their address. Three: The bounce/ooo-reply is sent to the message author, not to any intermediate host(s). After all, on that end, it's normal email failure response -- notify the author of the message. It doesn't matter that the original message was posted on a Usenet newsgroup if that group is automatically relayed to members of a mailing list. OK, you win. Since I don't care to get the bounce and out-of-office messages, I'll fix my from: header when posting to this group. -- Grant Edwards grante Yow! Am I having fun yet? at visi.com -- http://mail.python.org/mailman/listinfo/python-list
conditional install/distribution
Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version 2.6, is there a way to specifiy that in setup.py or easy_install cfg file so that when installing to python = 2.6, this module wouldn't be installed?? Thanks, Jim -- http://mail.python.org/mailman/listinfo/python-list
Please help me finding a way to implement os.path.issubpath(a, b)
Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): Return True if path1 is a sub path of path2. if path1 == path2: return False x1 = path1.split(os.sep) x2 = path2.split(os.sep) return x1[:len(x2)] == x2 ...but if I use issubpath('C:\\dir', 'C:\\') it returns False. A little help would be appreciated. Thanks in advance. --- Giampaolo http://code.google.com/p/pyftpdlib/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python platform.
On Sep 11, 11:13 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Sep 11, 4:19 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I wonder if there is a platform written in python. The equivalent of the Netbeans platformhttp://platform.netbeans.org/inthe Python world. Do you know such a thing? You (or maybe the Java folks) seem to have missed that platform has a rather specific meaning in computing: http://en.wikipedia.org/wiki/Platform_(computing) Given that definition, Python is pretty much a platform in itself. If you want to use Python for a specific task, you add libraries for that task. Tell us what you want to do, and we'll tell you what libraries and toolkits you might want to try. /F I want to build a desktop application. I am searching for some kind of environment that would provide all the elements ready (Windows...). Then I would have to code the business logic only. Jonathan. What's business logic? -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC filter
On Sep 10, 2:04 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: On 9 Set, 17:55, Diez B. Roggisch [EMAIL PROTECTED] wrote: I would go for a slightly different approach: make your server have a dispatch-method that delegates the calls to the underlying actual implementation. But *before* that happens, extract the information as above, and either - prepend it to the argument list - stuff it into threadlocal variables, and only access these if needed in your implementation. Diez Are you suggesting me to overwrite the _dispatch(self, method, params) method of SimpleXMLRPCDispatcher? I thought to this possibility, but it only accepts method and params as arguments, so, as far as I know, I have no way to get the user and host address to append. Perhaps I've misunderstood your suggestion... in that case can you post a short example? Ah, darn. Yes, you are right of course, the information itself is not available, as you don't have access to the request. I gotta ponder this a bit more. Diez Because he wants to insert parameters at the very start, he can probably get away with modifying the xml directly. Just find the position of the params (i think thats the tag) and insert the xml you need after it. Its pretty dirty, but would work. The wire format isn't that complicated. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python platform.
carriere.jonat...: I want to build a desktop application. I am searching for some kind of environment that would provide all the elements ready (Windows...). Then I would have to code the business logic only. I don't think there's such thing in Python, all elements ready sounds strange :-) Maybe you may appreciate Dabo: http://dabodev.com/ Or maybe Pythoncard? Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: Python platform.
[EMAIL PROTECTED] wrote: I want to build a desktop application. I am searching for some kind of environment that would provide all the elements ready (Windows...). Then I would have to code the business logic only. start here: http://wiki.python.org/moin/GuiProgramming The big ones are Tkinter, which is usually bundled with Python; wxPython, and PyQt. There's also a trend towards using the web browser as a presentation engine also for local applications; for libraries that help you with that, you can start here: http://wiki.python.org/moin/WebProgramming or jump directly to http://www.djangoproject.com/ /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Use Python to solve equations?
On Sep 11, 1:11 am, Uwe Schmitt [EMAIL PROTECTED] wrote: Kelie look atwww.sagemath.com. it is great. greetings, uwe Thanks Uwe! -- http://mail.python.org/mailman/listinfo/python-list
ReportLab 2.2 has been released
Version 2.2 of the ReportLab open-source toolkit is out! You find downloads and src instructions at http://www.reportlab.org/downloads.html. Contributions = Thanks to everybody who has contributed to the open-source toolkit in the run-up to the 2.2 release, whether by reporting bugs, sending patches, or contributing to the reportlab-users mailing list. Thanks especially to the following people, who contributed code that has gone into 2.2: including, but not limited to (apologies to any missed out) Matt Folwell, Jerome Alet, Harald Armin Massa, [EMAIL PROTECTED], Sebastian Ware, Martin Tate, Wietse Jacobs, Christian Jacobs, Volker Haas, Dinu Gherman, Dirk Datzert Yuan Hong. If we missed you, please let us know! New Features PDF pdfmetrics: Added registerFontFamily function Basic support for pdf document viewer preferences (e.g.: fullscreen). Platypus Paragraph img tag support for inline images. Paragraph autoleading support (helps with img tags). Platypus doctemplate programming support. Support for tables with non-uniform row length. Graphics RGBA image support for suitable bitmap types. LTO labelling barcode. And many bugfixes... -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a SOAP module that can do this...?
thebjorn wrote: I've been trying to use SOAPpy and ZSI (with and without the use of wsdl2py) to communicate with a SOAP server (looks like it's a WebLogic server(?) in front of some enterprise java bean) and not having much luck. Have you tried using soaplib? I find it very usable and from what I heard so far, a couple of other people also like it a lot better than ZSI. Stefan -- http://mail.python.org/mailman/listinfo/python-list
How to Determine Name of the Day in the Week
Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as Monday ... Sunday? I would like to do this without creating a data mapping. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
hofer wrote: The real example would be more like: name,age,country = itemgetter('name age country'.split())(x) ouch. if you do this a lot (=more than once), just wrap your dictionaries in a simple attribute proxy, and use plain attribute access. that is, given class AttributeWrapper: def __init__(self, obj): self.obj = obj def __getattr__(self, name): try: return self.obj[name] except KeyError: raise AttributeError(name) or, shorter but less obvious and perhaps a bit too clever for a beginning Pythoneer: class AttributeWrapper: def __init__(self, obj): self.__dict__.update(obj) you can do some_data = dict(name=Some Name, age=123, country=SE) some_data {'country': 'SE', 'age': 123, 'name': 'Some Name'} this = AttributeWrapper(some_data) this.name 'Some Name' this.age 123 this.country 'SE' and, if you must, assign the attributes to local variables like this: name, age, country = this.name, this.age, this.country name 'Some Name' age 123 country 'SE' (the next step towards true Pythonicness would be to store your data in class instances instead of dictionaries in the first place, but one step at a time...) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: How to Determine Name of the Day in the Week
Henry Chang wrote: Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as Monday ... Sunday? I would like to do this without creating a data mapping. :) if you have a datetime or date object, you can use strftime with the appropriate formatting code. see the library reference for details. if you have the weekday number, you can use the calender module: import calendar calendar.day_name[0] 'Monday' (the latter also contains abbreviated day names, month names, and a bunch of other potentially useful functions and mappings.) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic allocation file buffer
On Sep 11, 2:40 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 10 Sep 2008 11:59:35 -0700, Aaron \Castironpi\ Brady wrote: On Sep 10, 5:24 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 10 Sep 2008 09:26:20 +0200, Fredrik Lundh wrote: Steven D'Aprano wrote: You've created a solution to a problem which (probably) only affects a very small number of people, at least judging by your use-cases. Who has a 4GB XML file Getting 4GB XML files from, say, logging processes or databases that can render their output as XML is not that uncommon. They're usually record-oriented, and are intended to be processed as streams. And given the right tools, doing that is no harder than doing the same to a 4GB text file. Fair enough, that's a good point. But would you expect random access to a 4GB XML file? If I've understood what Castironpi is trying for, his primary use case was for people wanting exactly that. -- Steven Steven, Are you claiming that sequential storage is sufficient for small amounts of data, and relational db.s are necessary for large amounts? I'm no longer *claiming* anything, I'm *asking* whether random access to a 4GB XML file is something that is credible or useful. It is my understanding that XML is particularly ill-suited to random access once the amount of data is too large to fit in RAM. I'm interested in what Fredrik has to say about this, as he's the author of ElementTree. -- Steven XML is the wrong word for the example I was thinking of (as was already pointed out in another thread). XML is by definition sequential. The use case pertained to a generic element hierarchy; think of 4GB of hierarchical data. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to Determine Name of the Day in the Week
Awesome, that worked. Thanks so much! On Thu, Sep 11, 2008 at 10:16 AM, Fredrik Lundh [EMAIL PROTECTED]wrote: Henry Chang wrote: Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as Monday ... Sunday? I would like to do this without creating a data mapping. :) if you have a datetime or date object, you can use strftime with the appropriate formatting code. see the library reference for details. if you have the weekday number, you can use the calender module: import calendar calendar.day_name[0] 'Monday' (the latter also contains abbreviated day names, month names, and a bunch of other potentially useful functions and mappings.) /F -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic allocation file buffer
On Sep 11, 5:35 am, Paul Boddie [EMAIL PROTECTED] wrote: On 11 Sep, 10:34, Fredrik Lundh [EMAIL PROTECTED] wrote: And as I said before, the only use case for *huge* XML files I've ever seen used in practice is to store large streams of record-style data; I can imagine that the manipulation of the persistent form of large graph structures might be another use case, although for efficient navigation of such a structure, which is what you'd need to start applying various graph algorithms, one would need some kind of index. Certainly, we're straying into database territory. Paul An acquaintance suggests that defragmentation would be a useful service to provide along with memory management too, which also requires an index. I encourage overlap between a bare-bones alloc/free module and established database territory and I'm very aware of it. Databases already support both concurrency and persistence, but don't tell me you'd use a database for IPC. And don't tell me you've never wished you had a reference to a record in a table so that you could make an update just by changing one word of memory at the right place. Sometimes databases are overkill where all you want is dynamic allocation. -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating ordered expat attributes with tuplets?
On Sep 11, 4:48 pm, Manuel Ebert [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ah, well. Don't know whether it meets your aesthetic standards, but: my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] my_list[0:len(a):2] ['tree', 'flower', 'bear'] my_list[1:len(a):2] ['hug', 'hug', 'run'] and hence zip(my_list[0:len(a):2], my_list[1:len(a):2]) [('tree', 'hug'), ('flower', 'hug'), ('bear', 'run')] and furthermore for a, b in zip(my_list[0:len(a):2], my_list[1:len(a):2]): ... print a, b ... tree hug flower hug bear run or the slightly less obfuscated: for index in range(0, len(my_list), 2): ... print my_list[index], my_list[index + 1] ... tree hug flower hug bear run [snip] I don't know what the len(a) is, but the end position defaults to the end: zip(my_list[0::2], my_list[1::2]) [('tree', 'hug'), ('flower', 'hug'), ('bear', 'run')] -- http://mail.python.org/mailman/listinfo/python-list
Re: dict slice in python (translating perl to python)
On Sep 11, 10:52 am, hofer [EMAIL PROTECTED] wrote: On Sep 11, 10:36 am, Nick Craig-Wood [EMAIL PROTECTED] wrote: I'd type the explicit v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars Either is only a couple more characters to type. It is completely explicit and comprehensible to everyone, in comparison to v1,v2,v3 = [ mydict[k] for k in ['one','two','two']] # 52 chars v1,v2,v3 = [ mydict[k] for k in 'one two two'.split()] # 54 chars Unlike perl, it will also blow up if mydict doesn't contain 'one' which may or may not be what you want. Is your above solution robust against undefined keys. In my example it would'nt be a problem. The dict would be fully populated, but I'm just curious. If undefined keys aren't a problem, then there's a value you expect from them. Use v1,v2,v3 = [ mydict.get(k,default) for k in 'one two two'.split()] where default is the value you're expecting. -- http://mail.python.org/mailman/listinfo/python-list
Re: Please help me finding a way to implement os.path.issubpath(a, b)
On Sep 11, 5:40 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote: Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): Return True if path1 is a sub path of path2. if path1 == path2: return False x1 = path1.split(os.sep) x2 = path2.split(os.sep) return x1[:len(x2)] == x2 ...but if I use issubpath('C:\\dir', 'C:\\') it returns False. A little help would be appreciated. Thanks in advance. That's because: 'C:\\dir'.split('\\') ['C:', 'dir'] 'C:\\'.split('\\') ['C:', ''] So you could write instead something like x1 = path1.rstrip(os.sep).split(os.sep) x2 = path2.rstrip(os.sep).split(os.sep) in your function HTH -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: conditional install/distribution
i3dmaster schrieb: Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version 2.6, is there a way to specifiy that in setup.py or easy_install cfg file so that when installing to python = 2.6, this module wouldn't be installed?? you can simply import sys and check sys.version in the setup-script, and abort with an error-message if the expectations aren't matched. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Please help me finding a way to implement os.path.issubpath(a, b)
Giampaolo Rodola' schrieb: Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): Return True if path1 is a sub path of path2. if path1 == path2: return False x1 = path1.split(os.sep) x2 = path2.split(os.sep) return x1[:len(x2)] == x2 ...but if I use issubpath('C:\\dir', 'C:\\') it returns False. A little help would be appreciated. Any reason why os.path.normpath(a).startswith(os.normpath(b)) doesn't do the trick? Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve file name extention
On Sep 8, 1:47 pm, [EMAIL PROTECTED] wrote: Monu When I am using shelve on my local machine it generates the db Monu file as given filename. But in another machine it's generating Monu filename.dat and .dir. can anyone tell me how can I force sheve Monu module to write the db in filename.dir and filename.dat, Monu instead of filename? Do I have to install a specific version of Monu the python? Shelve is just a thin layer on top of a concrete db file module. Sounds like on your two machines there are different underlying db file modules available. You're pretty much at the mercy of those modules as to file naming. All you are giving it when opening a shelve file is the prefix. Skip Thanks Skip. So Can't I choose which module to use. Is there any preferance on which shelve chooses these modules? -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve file name extention
On Sep 8, 1:47 pm, [EMAIL PROTECTED] wrote: Monu When I am using shelve on my local machine it generates the db Monu file as given filename. But in another machine it's generating Monu filename.dat and .dir. can anyone tell me how can I force sheve Monu module to write the db in filename.dir and filename.dat, Monu instead of filename? Do I have to install a specific version of Monu the python? Shelve is just a thin layer on top of a concrete db file module. Sounds like on your two machines there are different underlying db file modules available. You're pretty much at the mercy of those modules as to file naming. All you are giving it when opening a shelve file is the prefix. Skip Thanks Skip. So Can't I choose which module to use. Is there any preferance on which shelve chooses these modules? -- http://mail.python.org/mailman/listinfo/python-list
Re: Please help me finding a way to implement os.path.issubpath(a, b)
Diez B. Roggisch wrote: Any reason why os.path.normpath(a).startswith(os.normpath(b)) doesn't do the trick? Except for the trivial type, you mean? That depends on whether c:\foo should be seen as a subpath to c:\foobar or not. I'd probably go for (also untested): def issubpath(a, b): def fixpath(p): return os.path.normpath(p) + os.sep return fixpath(a).startswith(fixpath(b)) /F -- http://mail.python.org/mailman/listinfo/python-list
wx
I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've searched the Python website and could find no reference to module wx. Is this an add-in module or perhaps it was replaced in v2.5.2??? References in the code are: wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) self.SetColumnWidth(0, WX.LIST_AUTOSIZE)) idx = self.GetNextItem(idx, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE) Any help would be greatly appreciated! I do have Shrubbery! Scott Scott E. Desmond Director Manager Equity Systems Development IT Integration Lead Mellon Capital Management Corporation 500 Grant Street, Suite 4200 Pittsburgh, PA 15258 T 412.236.0405 | F 412.236.1703 [EMAIL PROTECTED] | www.mcm.com The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.(16b) Disclaimer Version MB.US.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: shelve file name extention
Monu wrote: So Can't I choose which module to use. Is there any preferance on which shelve chooses these modules? it uses the anydbm module to look for available DBM-style drivers, which looks for modules in the following order: dbhash, gdbm, dbm, dumbdbm. if you know which one you want, you can open the database file yourself, and pass it to the Shelf constructor: import shelve import somedbm db = shelve.Shelf(somedbm.open(file, flag)) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: wx
The module you are talking about is a python GUI toolkit named WxPython, which is a port of the cross platform C++ GUI toolkit wxwidgets. It's an excelent gui toolkit , easy to learn and code on. Well documented and has an excelent community around it. Here are the links for both sites: http://www.wxpython.org/ http://www.wxwidgets.org/ On Thu, Sep 11, 2008 at 8:16 PM, Desmond Scott E [EMAIL PROTECTED] wrote: I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've searched the Python website and could find no reference to module wx. Is this an add-in module or perhaps it was replaced in v2.5.2??? References in the code are: wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) self.SetColumnWidth(0, WX.LIST_AUTOSIZE)) idx = self.GetNextItem(idx, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE) Any help would be greatly appreciated! I do have Shrubbery! Scott Scott E. Desmond Director Manager Equity Systems Development IT Integration Lead Mellon Capital Management Corporation 500 Grant Street, Suite 4200 Pittsburgh, PA 15258 T 412.236.0405 | F 412.236.1703 [EMAIL PROTECTED] | *www.mcm.com* *The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee.* *Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized.* *If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.(16b)* ** Disclaimer Version MB.US.1 -- http://mail.python.org/mailman/listinfo/python-list -- My Blog: http://mylifeasadeveloper.blogspot.com/ My home page: http://www.inet.hr/~nstjelja My Poetry Book: http://www.lulu.de/browse/book_view.php?fCID=222964fBuyItem=5 My OS Projects: http://lab.linux.hr/~nstjelja/drawit/ -- http://mail.python.org/mailman/listinfo/python-list
Re: wx
Desmond Scott E wrote: I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've searched the Python website and could find no reference to module wx. Is this an add-in module or perhaps it was replaced in v2.5.2??? wx is wxPython: http://www.wxpython.org/ /F -- http://mail.python.org/mailman/listinfo/python-list