Re: What about letting x.( ... ? ... ) be equivalent to ( ... x ... )
Fredrik Lundh a écrit : > if you have a fear of introducing new local variables, you have problems > that cannot be solved by syntax. Dear Fredrik, I have read the original messages on fr.comp.lang.python, and I don't understand your answer. It is not about a fear of introducing new local variables, but for me it is an elegant solution to a common problem, to avoid creation of useless variables (what in french we call "variables muettes", like indexes in loops who are just there because some langages level is too low). It also avoid the increase of parenthesis depth, and so the readability is enhanced. And it solve a problem that in all object oriented langages, a method that process 2 or more different classes of objets belongs just to one of those classes. All this kind of problems appears often to me (and in different langages), and contrarily to you, I'm very impressed by the compacity and elegance of the solution. I think it would be nice if implemented in different langages (because it breaks nothing), and firstly Python. Best regards, Al PS : sorry for my approximative english, but my natural langage is french. -- http://mail.python.org/mailman/listinfo/python-list
Re: What about letting x.( ... ? ... ) be equivalent to ( ... x ... )
> It seems to me that what you proposed was a "solution", that seems > obvious only to you, to a problem perceived only by you. > > I am afraid you would have to work rather harder to persuade me that > there is a problem, let alone that you have found the solution to it. Hello, I never said there is a problem, since you can do whithout it. I just said that in some cases, it's better and cleaner to do it in another way, and also that this solution is a complement : it does not replace or break nothing. Regards, Al -- http://mail.python.org/mailman/listinfo/python-list
Exchanging data with a C program using shared memory (sysV IPC)
Hello, I want my python application to communicate with an legacy C program which read/write data in a shared memory (Unix Sys V IPC). It seems that there are no official shm nor sysV ipc module, and that non-official ones are dead. I can't modify the C code to change its communication method. How would you solve this problem using python ? Is there any reason there is no official shm for python ? I could write a C code which communicates with my python application using mmap or something else and with the old C code using shmat(), but this is a rather ugly solution. Thanks in advance. --- Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Exchanging data with a C program using shared memory (sysV IPC)
"slacker" <[EMAIL PROTECTED]> writes: Hello slacker, > Al wrote: > >> I want my python application to communicate with an legacy C program which >> read/write data in a shared memory (Unix Sys V IPC). > > Have you looked at the dl module? Types and portability aside, it > might provide you with what you need. > > Cheers, > > - slacker Thank you very much for your advice. I didn't use the dl module, but searching information on dl, led me to the 'new' ctype one which is perfect for my use. -- Al -- http://mail.python.org/mailman/listinfo/python-list
Pycron for windows - please help
Hey all, I'm using Pycron for windows to run 5 scripts at various times of the day, all of which work well. I recently added a 6th job, a simply file copy operation, and it won't run. Once the job is configured, I click the test execution button, and it works fine. However, it won't run automatically. I looked in the pycron.log file, and I noticed that for the entires of my new job, I see "rc=4" and the end of each line. All other jobs have "rc=0" at the end of the line. I assume then, that rc=4 is a reference to an error code of some kind, but there is no information on this in the readme.txt, at the pycron website, or here in groups. Does anyone know how to troubleshhot this? Thanks in advance. Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Pycron for windows - please help
heh... didn't think about that... thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pycron for windows - please help
Shane, I figured it out... Pycron does not work with mapped drives. My script was supposed to copy files from a mapped drive to a local folder... I had set up my batch command as copy M:\foldername\*.*, where M: is a mapped drive pointing to the network share; M: is defined on the PC running the Pycron service of course. I changed it to read copy \\servername\shares\foldername\*.* and now everything works correctly. Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Pycron for windows - please help
> Mapped drives are per-user. Usually, services run under the LOCAL_SYSTEM > account, not using the currently logged user (because they may start even > before any user is logged). If you want the service to have access to your > mapped drives, use the service control panel to make it run under another > account. Pycron runs under our domain admin account, and the computer on which it runs is always on. I tried changing the account anyway, but no luck. -- http://mail.python.org/mailman/listinfo/python-list
multiprocessing and Array problems
I am not subscribed to these lists but I do check them occasionally and will check them more frequently looking for a response. I am getting a pickling error that I do not understand. It seems the shared arrays that I create cannot be pickled. Makes the multiprocessing.Array fairly useless if it cannot be pickled. Hence, I am guessing that I am doing something wrong and would like some help spotting it. This is basically a cut and paste from the examples in the documentation: import ctypes import multiprocessing def subproc (a, i): print ("From subprocess " + str(i)) print (a[:]) return if __name__ == "__main__": nproc = 3 print ("\nBuilding the array for the second computation.") b = multiprocessing.Array (ctypes.c_double, nproc*nproc, lock=False) print ("\nSending the task across to see what happens.") pool = multiprocessing.Pool(nproc) for i in range(nproc): pool.apply_async (subproc, kwds={'a':b, 'i':i}) pool.close() pool.join() pass Whether I run it on 2.6, 2.7, or 3.2 I get the same error. Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner self.run() File "/usr/lib/python2.6/threading.py", line 484, in run self.__target(*self.__args, **self.__kwargs) File "/usr/lib/python2.6/multiprocessing/pool.py", line 225, in _handle_tasks put(task) PicklingError: Can't pickle : attribute lookup multiprocessing.sharedctypes.c_double_Array_9 failed Anyone want to take a stab as to why this error message is being generated? Again I have tried python 2.6.7, 2.7.2+, and 3.2.2. Thanks for any and all help in advance. -- Al Niessner I have never found the companion that was so companionable as solitude. - From Walden by Henry David Thoreau The universe is indifferent, and life is brutal; however, it is man's choice of behavior that makes them malevolent rather than benevolent. Some will fall in love with life and drink it from a fountain That is pouring like an avalanche coming down the mountain. - From the song Pepper by the Butthole Surfers -- http://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing and Array problems
Here is an update. def subproc (i): print ("From subprocess " + str(i)) print (b[:]) return if __name__ == "__main__": nproc = 3 print ("\nBuilding the array for the second computation.") b = multiprocessing.Array (ctypes.c_double, nproc*nproc, lock=False) print ("\nSending the task across to see what happens.") pool = multiprocessing.Pool(nproc) for i in range(nproc): pool.apply_async (subproc, kwds={'i':i}) pool.close() pool.join() pass Does work. It is not what I need though. I need to be able to pass b as an argument. The reason is that I create some of these in a loop and they are not in a global space nor are they know prior to creating the pool. On Thu, 2012-04-12 at 11:15 -0700, Al Niessner wrote: > I am not subscribed to these lists but I do check them occasionally and > will check them more frequently looking for a response. > > I am getting a pickling error that I do not understand. It seems the > shared arrays that I create cannot be pickled. Makes the > multiprocessing.Array fairly useless if it cannot be pickled. Hence, I > am guessing that I am doing something wrong and would like some help > spotting it. > > This is basically a cut and paste from the examples in the > documentation: > > import ctypes > import multiprocessing > > def subproc (a, i): > print ("From subprocess " + str(i)) > print (a[:]) > return > > if __name__ == "__main__": > nproc = 3 > print ("\nBuilding the array for the second computation.") > b = multiprocessing.Array (ctypes.c_double, nproc*nproc, lock=False) > > print ("\nSending the task across to see what happens.") > pool = multiprocessing.Pool(nproc) > for i in range(nproc): pool.apply_async (subproc, kwds={'a':b, > 'i':i}) > pool.close() > pool.join() > pass > > Whether I run it on 2.6, 2.7, or 3.2 I get the same error. > > Exception in thread Thread-1: > Traceback (most recent call last): > File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner > self.run() > File "/usr/lib/python2.6/threading.py", line 484, in run > self.__target(*self.__args, **self.__kwargs) > File "/usr/lib/python2.6/multiprocessing/pool.py", line 225, in > _handle_tasks > put(task) > PicklingError: Can't pickle 'multiprocessing.sharedctypes.c_double_Array_9'>: attribute lookup > multiprocessing.sharedctypes.c_double_Array_9 failed > > > Anyone want to take a stab as to why this error message is being > generated? Again I have tried python 2.6.7, 2.7.2+, and 3.2.2. > > Thanks for any and all help in advance. > -- Al Niessner I have never found the companion that was so companionable as solitude. - From Walden by Henry David Thoreau The universe is indifferent, and life is brutal; however, it is man's choice of behavior that makes them malevolent rather than benevolent. Some will fall in love with life and drink it from a fountain That is pouring like an avalanche coming down the mountain. - From the song Pepper by the Butthole Surfers -- http://mail.python.org/mailman/listinfo/python-list
No registration confirmation at https://bugs.python.org/
I have tried to register at https://bugs.python.org/ over a period of many months, and I never receive the confirmation email to complete the process. Who can help with this? Thanks. --Al -- https://mail.python.org/mailman/listinfo/python-list
Re: No registration confirmation at https://bugs.python.org/
No spam or junk on either email client or server. On Sun, 2016-10-16 at 11:20 +1100, Steve D'Aprano wrote: > On Sun, 16 Oct 2016 07:09 am, Al Schapira wrote: > > > > > I have tried to register at https://bugs.python.org/ over a > > period > > of many months, and I never receive the confirmation email to > > complete > > the process. Who can help with this? Thanks. > > --Al > Have you checked your Junk Mail folder? > > Unfortunately there are at least four open issues relating to email > from the > bug tracker being marked as spam: > > http://psf.upfronthosting.co.za/roundup/meta/ > > > > > -- > Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and > sure > enough, things got worse. > -- https://mail.python.org/mailman/listinfo/python-list
Re: IP address to binary conversion
Just for the records and to have a fully working bidirectional solution: >>> ip '10.44.32.0' >>> struct.unpack('L', socket.inet_aton(ip))[0] 2108426 >>> socket.inet_ntoa(struct.pack('>> Good luck ;-) -- https://mail.python.org/mailman/listinfo/python-list
Re: IP address to binary conversion
Hi Alan, Yes, agreed that any '!I' or '!L' combination will work on different type of platforms in a consistent manner, when applied in both directions. I was referring to Alex Martelli's output, where the conversion back to IP seems to be reversed, even with '!L', which means that he's already with a little-endian byte order and using 'L' or '>> ip = '1.2.168.0' >>> struct.unpack('L', socket.inet_aton(ip))[0] 11010561 >>> struct.unpack('>> struct.unpack('!L', socket.inet_aton(ip))[0] 16951296 >>> >>> socket.inet_ntoa(struct.pack('!L',11010561)) '0.168.2.1' >>> socket.inet_ntoa(struct.pack('>> socket.inet_ntoa(struct.pack('!L',16951296)) '1.2.168.0' >>> Greets, Alex -- https://mail.python.org/mailman/listinfo/python-list
Controlling Excel with win32com
I'm starting to test a python application that creates an Excel workbook, then fills in values for some cells and formulas for other cells. The formulas involve circular references, which will cause Excel to take a little time to update and iterate through the successive approximations of finding a solution to the formulas. (The system should converge pretty well -- no bad behavior expected.) Since Excel runs as a com server in another window, is there anything that the python side of the win32com connection has to do to make sure that it is not calling Excel while Excel is busy recalculating or otherwise processing a previous request? Are the assignments to the cell Value and Formula properties synchronized for me somewhere? I think that I've noticed a run-sometimes/crash-sometimes behavior in this program, but I'm so clueless about what's going on behind the scenes with com that I haven't really tied it down. It seemed to get better behaved when I turned off automatic recalculation, but that does not seem to me to be a guarantee that there will be no timing problems if the messages are not queued somewhere and if there is not some other mechanism to keep things synchronized. What works best? TIA Al -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: why are LAMP sites slow?
In article <[EMAIL PROTECTED]>, Tim Daneliuk <[EMAIL PROTECTED]> wrote: >Paul Rubin wrote: > > > >> I've only worked on one serious site of this type and it was "SAJO" >> (Solaris Apache Java Oracle) rather than LAMP, but the concepts are >> the same. I just feel like something bogus has to be going on. I >> think even sites like Slashdot handle fewer TPS than a 1960's airline >> reservation that ran on hardware with a fraction of the power of one >> of today's laptops. > >I worked for an Airline computer reservation system (CRS) for almost a >decade. There is nothing about today's laptops that remotely comes close >to the power of those CRS systems, even the old ones. CRS systems are >optimized for extremely high performance I/O and use an operating system >(TPF) specifically designed for high-performance transaction processing. > >Web servers are very sessions oriented: make a connection-pass the unit >of work-drop the connection. This is inherently slow (and not how high >performance TP is done). Moreover, really high perfomance requires a >very fine level of I/O tuning on the server - at the CRS I worked for, >they performance people actually only populated part of the hard drives >to minimize head seeks. > >The point is that *everything* has to be tuned for high performance >TP - the OS, the language constructs (we used assembler for most things), >the protocols, and the overall architecture. THis is why, IMHO, >things like SOAP a laughable - RPC is a poor foundation for reliable, >durable, and high-performance TP. It might be fine for sending an >order or invoice now and then, but sustained throughput of the sort >I think of as "high" performance is likely never going to be accomplished >with session-oriented architectures. > >For a good overview of TP design, see Jim Gray's book, "Transaction Processing: >Concepts and Techniques". > >P.S. AFAIK the first CRS systems of any note came into being in the 1970s not > the 1960s, but I may be incorrect in the matter. >-- > >Tim Daneliuk [EMAIL PROTECTED] >PGP Key: http://www.tundraware.com/PGP/ My recollection is that online reservations were in use ca. 1970, and I know that the operating system was called ACP, renamed to TPF. Googleing for that finds that online reservation systems stared in the 50's and ran on 7000 gear in the 60's. http://www.blackbeard.com/tpf/Sabre_off_TPF/some_highlights_from_sabre_history.htm I was in banking in th 80's. I recall that circa 1990 hitting 1000 DB trans/sec was the holy grail on a million $ mainframe. My bank bought what was called "the last TPF sale" about 1991. It was used as a "message router" to conect transactions from thousands ATMs and teller stations to the right backend system necessary to make a bank merger work. -- a d y k e s @ p a n i x . c o m Don't blame me. I voted for Gore. -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: why are LAMP sites slow?
In article <[EMAIL PROTECTED]>, Tim Daneliuk <[EMAIL PROTECTED]> wrote: >Paul Rubin wrote: > >> Tim Daneliuk <[EMAIL PROTECTED]> writes: >> >>>I worked for an Airline computer reservation system (CRS) for almost a >>>decade. There is nothing about today's laptops that remotely comes close >>>to the power of those CRS systems, even the old ones. CRS systems are >>>optimized for extremely high performance I/O and use an operating system >>>(TPF) specifically designed for high-performance transaction processing. >> >> >> Yeah, I've been interested for a while in learning a little bit about >> how TPF worked. Does Gray's book that you mention say much about it? > >I honestly do not recall. TPF/PAARS is an odd critter unto itself >that may not be covered by much of anything other than IBM docs. I've seen it covered in some textbook, possibly something by Tanenbaum. I imagine it's in the ACM literature and the IBM Systems Journal. If we move this thread to alt.folklore.computers we'll get lots of good info. -- a d y k e s @ p a n i x . c o m Don't blame me. I voted for Gore. -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: why are LAMP sites slow?
In article <[EMAIL PROTECTED]>, Dave Brueck <[EMAIL PROTECTED]> wrote: >Paul Rubin wrote: >> How would you go about building such a site? Is LAMP really the right >> approach? > >Two major problems I've noticed, don't know if they are universal, but they >sure >hurt the performance: > >1) Some sites have not put any thought into caching - i.e. the application >server is serving up images or every single page is dynamically generated even >though all (or most) of it is static such that most of the requests just >aren't >cacheable. > >2) Because a database is there, it gets used, even when it shouldn't, and it >often gets used poorly - bad or no connection pooling, many trips to the >database for each page generated, no table indices, bizarro database schemas. > >Overall I'd say my first guess is that too much is being generated on the fly, >often because it's just easier not to worry about cacheability, but a good web >cache can provide orders of magnitude improvement in performance, so it's >worth >some extra thought. > >One project we had involved the users navigating through a big set of data, >narrowing down the set by making choices about different variables. At any >point >it would display the choices that had been made, the remaining choices, and >the >top few hits in the data set. We initially thought all the pages would have to >be dynamically generated, but then we realized that each page really >represented >a distinct and finite state, so we went ahead and built the site with Zope + >Postgres, but made it so that the URLs were input to Zope and told what state >to >generate. > >The upshot of all this is that we then just ran a web spider against Zope any >time the data changed (once a week or so), and so the site ended up "feeling" >pretty dynamic to a user but pretty much everything came straight out of a >cache. > >-Dave A couple years ago the Tomshardware.com website was reengeneered to cache everything possible with great performance improvement. They wrote a nice article about the project, which I assume is still online. I don't -- a d y k e s @ p a n i x . c o m Don't blame me. I voted for Gore. -- http://mail.python.org/mailman/listinfo/python-list
Re: IronPython 0.9 Released
EP wrote: > > yes, my apologies to all things Iron and or Python. > > "language" and "version" can be confusing if one stays up late without > coffee, or perhaps if one has not been debugging their English code properly. > Still, it's a bit of a PITB to me that it says XP and not Win2000. Al -- http://mail.python.org/mailman/listinfo/python-list
Re: PyChecker lives, version 0.8.15 released
Neal Norwitz wrote: > Special thanks to Ken Pronovici. He did a lot of work for this > release and helped ensure it occurred. > > Version 0.8.15 of PyChecker is available. It's been over a year since > the last release. Wow, time really does fly. Since it's been so long > I'm sure I screwed something up, treat it delicately. It may have bugs > and erase your hard drive. If that happens, look on the bright side, > you won't have any more bugs. :-) > > PyChecker is a tool for finding bugs in Python source code. > It finds problems that are typically caught by a compiler for less > dynamic languages, like C and C++. It is similar to lint. > > Comments, criticisms, new ideas, and other feedback is welcome. > > Since I expect there may be a bit more bugs than normal, I will try to > put out another release in a few weeks. Please file bug reports > including problems with installation, false positives, &c on Source Forge. > You are welcome to use the mailling list to discuss anything pychecker > related, including ideas for new checks. > > Changes from 0.8.14 to 0.8.15: > > * Fix spurious warning about catching string exceptions > * Don't barf if there is # -*- encoding: ... -*- lines and unicode strings > * setup.py was rewritten to honor --root, --home, etc options > * Fix internal error on processing nested scopes > * Fix constant tuples in Python 2.4 > * Don't warn about implicit/explicit returns in Python 2.4, we can't tell > * Fix crash when __slots__ was an instance w/o __len__ > * Fix bug that declared {}.pop to only take one argument, it takes 1 or 2 > * Fix spurious warning when using tuples for exceptions > * Fix spurious warning / > * Fix spurious warnings for sets module about __cmp__, __hash__ > * Changed abstract check to require raising NotImplementedError > rather than raising any error > * Fix spurious warnings in Python 2.4 for Using is (not) None warnings > * Fix spurious warnings for some instances of No class attribute found > * Fix spurious warnings for implicit returns when using nested functions > > PyChecker is available on Source Forge: > Web page: http://pychecker.sourceforge.net/ > Project page: http://sourceforge.net/projects/pychecker/ > Mailing List: [EMAIL PROTECTED] > > Neal > -- > [EMAIL PROTECTED] Not to complain, as this is a very useful one-of-a-kind tool, but it does appear to use more memory than I can imagine how when you run it on a substantial program. Like a few kilobytes per line of code, maybe. It's slow, too, but that's ok for the usefulness of it, but trying to let it run and do something else with someone else's code bloat (like MS Word or something) in another window leads to something indistinguishable from system meltdown. Any reason for hope of future improvements in this regard? Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Code to read Cobol data files
none wrote: > Hi, > Any one know of some code to read cobol data files > > thanks > timb I posted some here maybe 5+ years ago that would convert COBOL comp-3, comp-4, and comp-5 fields (as from Realia) to whatever. I suppose you can still find it in google somewhere. There was some help for cracking one of the other COBOL file formats at a site called Wotsit's file formats or something like that. This helped me access data out of ISAM files from one of the non-Realia desktop COBOLs. It was one of the more popular COBOL versions way back in the 1980's, but I don't recall anymore which one it was, but I'd guess RM Cobol if I had to. COBOL has/had an indexed file type defined in the language, and the COBOL vendors each implemented it independently, I think. So there are variations in both the coding of various field/record types and the way that the files are put together. But Python can handle it if you can figure out the rules. Al -- http://mail.python.org/mailman/listinfo/python-list
Article on Hi-Fi Myths
I learned Friday night that the hi-fi talk is our most popular tape. This page: http://www.belt.demon.co.uk/product/Cable_Controversy/Cable_Controversy.htm Gives a somewhat different take on the controversy, almost certainly bizarre. It's a long page and the interesting part is near the end. The conclusion is: "you just need to know what techniques to use to create a 'friendly', 'relaxing', energy pattern." Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Working with Huge Text Files
I did some similar stuff way back about 12-15 years ago -- in 640k MS-DOS with gigabyte files on 33 MHz machines. I got good performance, able to bring up any record out of 10 million or so on the screen in a couple of seconds (not using Python, but that should not make much difference, maybe even some things in Python would make it work better.) Even though my files were text, I read them as random-access binary files. You need to be able to dive in at an arbitrary point in the file, read a chunk of data, split it up into lines, discarding any partial lines at the beginning and end, pull out the keys and see where you are. Even with a gigabyte of file, if you are reading a decent size chunk, you can binary search down to the spot you want in 15-20 tries or so. That's the first time, but after that you've got a better idea where to look. Use a dictionary to save the information from each chunk to give you an index to get a headstart on the next search. If you can keep 10k to 100k entries in your index, you can do 1000's of searches or so before you even have to worry about having too many index entries. I did learn that on 32-bit hardware, doing a binary search of a file over a gigabyte will fail if you calculate the next place to look as (a+b)/2, because a+b can be more than 2GB and overflow. You gotta do (a + (b-a)/2) Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Working with Huge Text Files
Michael Hoffman wrote: [EMAIL PROTECTED] wrote: It will only be this simple if you can guarantee that the original file is actually sorted by the first field. And if not you can either sort the file ahead of time, or just keep reopening the files in append mode when necessary. You could sort them in memory in your Python program but given the size of these files I think one of the other alternatives would be simpler. There used to be a very nice sort program for PC's that came from someplace in Nevada. It cost less than $100 and could sort files faster than most programming languages could read or write them. For linux, you've gotta figure out the posix sort. If you do, please splain it to me. Al -- http://mail.python.org/mailman/listinfo/python-list
Re: Best GUI for small-scale accounting app?
Web browser "widgets" seem pretty limited to me, though. You don't even have something as simple as a combo box (i.e. an editable entry with a drop down), let alone the rich set of widgets something like wxwidgets offers. Also web development doesn't seem as coherent to me as development with a good GUI framework. I think it depends on your target audience. Many people love simplicity. wxPython has an HTML control that lets you do most of your UI web-like and just drop in the other wxWidgets kinds of controls here and there if you need to. The html control does most of the rendering and such, and you can do most of the user interaction with standard clickable links, etc, but you can also mix in the full boat of high-powered gizmos to perplex the users when you run out of other tactics and annoyances. Is it pretty? As a conglomerate with features of a desktop app and features of a browser-based app, it's kind of pretty like a platypus. Platypus, penguin, or python, there's many a way to lay an egg. Al -- http://mail.python.org/mailman/listinfo/python-list
ntvdm problem on win2k
I started having some problems running python programs (python 2.3) from the Win2k command line. I would get crashes with an NTVDM error. Even just executing python would cause it. I upgraded to python 2.3.5, and no difference. When I rearranged my path to move cygwin and a bunch of other stuff (.net, etc) after C:\python23, the problem went away. Is this problem known to anyone but me? Any diagnosis, solution of 12 or fewer steps, or support group? If I'm distributing python programs (python 2.3.5 packaged with py2exe) should I warn or notify the recipients that this is a possible problem with the programs? TIA Al -- http://mail.python.org/mailman/listinfo/python-list
Re: ntvdm problem on win2k
Here's some more info on this: When I use the Win2k feature to search for files, it turns up python.exe in the \cygwin\bin directory. The file size is shown as 24 bytes. Mighty small for an executable. The file is hidden. This is evidently the guy who was caussing the problem. Why does cygwin include a hidden file that hides python on the path? Al Christians wrote: I started having some problems running python programs (python 2.3) from the Win2k command line. I would get crashes with an NTVDM error. Even just executing python would cause it. I upgraded to python 2.3.5, and no difference. When I rearranged my path to move cygwin and a bunch of other stuff (.net, etc) after C:\python23, the problem went away. Is this problem known to anyone but me? Any diagnosis, solution of 12 or fewer steps, or support group? If I'm distributing python programs (python 2.3.5 packaged with py2exe) should I warn or notify the recipients that this is a possible problem with the programs? TIA Al -- http://mail.python.org/mailman/listinfo/python-list
Re: ntvdm problem on win2k
Alexander Schremmer wrote: Windows tries to execute the cygwin symbolic link and fails. Correcting your path works (as you said). One thing about that: I re-installed python (ie upgraded to python 2.3.5) and it did not solve the error. I assume that the python 2.3.5 installer is so well-mannered that it did not put itself at the head of the path, but saw that it was already in the path somewhere, and left itself there. This is nice, but it was disappointing, in that I did a fresh install to no avail. And, is it not fairly common for other installers of less refined software to add to the head of the path each time that they run, no matter how many times the same entry is repeated. So, by being very nice, python is sort of non-conformist or nearly eccentric, which I wish everyone would be. But how can one despise 99% of everything? When I installed cygwin, I checked it for python. It had something like python2.4.1.exe visible, but that symbolic link was not. No big deal. Al -- http://mail.python.org/mailman/listinfo/python-list
Logging to a file from a C-extension
If a logging file is opened at the level of a Python application, how would the log file name be communicated to a C-extension so that logging from the extension would be sent to the same log file? -- https://mail.python.org/mailman/listinfo/python-list
Re: The Nature of the Unix Philosophy
On 7 Jun 2006 18:35:52 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote: >The Nature of the Unix Philosophy Good grief. Him again. -- Al Balmer Sun City, AZ -- http://mail.python.org/mailman/listinfo/python-list
sockets programming with python on mobile phones
Hi everyone, Is it possible to write applications using sockets for network programming on MOBILE Phones( using Python on mobile phones such as nokia 66* series ) actually i want my mobile to 'TALK' to my pc 'WIRELESSLY' so i can send data between the two I think it works over the GPRS stack. PLEASE PLEASE help it is crucial for my major project and my guide dont have much(actually any) idea on this Thank You. -- http://mail.python.org/mailman/listinfo/python-list
Re: sockets programming with python on mobile phones
Thanks ! well..acutally this is siddharth dave i am a BIG al pacino fan ..(and before joning this grp i had just watched 'scent of a woman") hence this pun on myself!! neways thanks for replying ps: dear edwards watch 'scent of a woman' and u will forget 'doniie brosco'..:-) AL pacino won an oscar for that. Grant Edwards wrote: > On 2006-01-26, al pacino <[EMAIL PROTECTED]> wrote: > > > Is it possible to write applications using sockets for network > > programming on MOBILE Phones( using Python on mobile phones > > such as nokia 66* series ) > > > > actually i want my mobile to 'TALK' to my pc 'WIRELESSLY' so i can send > > data between the two > > Mr. Pacino, > > I just saw "Donnie Brasco" and thought you were brilliant. > However, I must say that you're chewing the SCENERY here a bit > with the semi-random SHOUTING. > > > I think it works over the GPRS stack. > > > > PLEASE PLEASE help it is crucial for my major project and my guide dont > > have much(actually any) idea on this > > Pretty brave leaving acting and starting a new career at your > age, but if you're determined to give it a go, try here: > >http://www.forum.nokia.com/python > > Amazing what you can find by googling for python+nokia, eh? > > -- > Grant Edwards grante Yow! In Newark the > at laundromats are open 24 >visi.comhours a day! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs C for a mail server
>but i am not able to choose the language.Should i go for C(socket API) Ravi is right (>using sockets is more or less the same from any language.) ..try JSP(java server pages), some guys in nit warangal implemented a mail server (foa LAN though)for their minor project. my contention is that using sockets(in c++) will improve your understanding of the protocol suite and improve your programming as well. Ravi Teja wrote: > >> Why don't you use an existing mail server? > > Probably because that was his homework assignment for a networking > class. Not uncommon to be told to implement a server from the scratch > from the RFC. Although that does not explain his concern about > performance. > > Abhinav, if that is the case, using sockets is more or less the same > from any language. Python as usual will be cleaner than C. You might > want to look at Twisted Mail. Use SocketServer module in the standard > library to implement the RFC. Other than that it is silly to try to > write a Mail Server unless you have some extra ordinary need. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs C for a mail server
jim you are probably right. i have had exp. with this. i had to create a server(multipurpose such as file sharing, games (pretty simple tho like tic tac toe..) we were in 6th sem with learning OS and comp. n/w for the first time. it seems like these jack ass jerks (proffs/instuctors) like to bully students... obviously we cud not complete the project as most of the time was spent on learning the stuff(like TCP, multithreading..) . i don't know how things work out in the west, but i feel the faculty really care about their students in american colleges..in contrast to here (in inida, though things are little different in the IITs) Jim Segrave wrote: > In article <[EMAIL PROTECTED]>, > Ravi Teja <[EMAIL PROTECTED]> wrote: > >>> Why don't you use an existing mail server? > > > >Probably because that was his homework assignment for a networking > >class. Not uncommon to be told to implement a server from the scratch > >from the RFC. Although that does not explain his concern about > >performance. > > > >Abhinav, if that is the case, using sockets is more or less the same > >from any language. Python as usual will be cleaner than C. You might > >want to look at Twisted Mail. Use SocketServer module in the standard > >library to implement the RFC. Other than that it is silly to try to > >write a Mail Server unless you have some extra ordinary need. > > Any lecturer assigning "write a mail server" as a class project is > doing his/her students a true dis-service. Mail server RFC compliance is a > nightmare to get right, performance issues and mail routeing are both > material for at least a full year's university study. > > A student who tries to make an even vaguely RFC compliant mail server > probably won't finish their project, as student who completes such a > project might come away with the mistaken belief that they actually > have done it correctly. > > The number of software products which use eail and do so incorrectly > is astounding and depressing. There's a reason that the source for > sendmail is about 120K lines, exim is nearly 270K lines. Doing it > right is _hard_. > > > > > > -- > Jim Segrave ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-list
Tk.quit() now working!
i have a weired problem with button widget in Tkinter the callback function(Tk.quit()) for button widget is not working! when i 'press' the button the GUI hangs. code for displaying a 'button objec': ### import Tkinter top=Tkinter.Tk() button=Tkinter.Button(top,text='press me',command=top.quit)#callback to end the appllication button.pack() Tkinter.mainloop() ### any comments? -- http://mail.python.org/mailman/listinfo/python-list
Re: Tk.quit() now working!
>how do you run your Tkinter program ? like? i was testing it in windows (interactive interpreter) -- http://mail.python.org/mailman/listinfo/python-list
Re: Xah's Edu Corner: accountability & lying thru the teeth
On Tue, 14 Feb 2006 23:59:19 GMT, Kenny Tilton <[EMAIL PROTECTED]> wrote: >Ulrich Hobelmann wrote: >> Xah Lee wrote: >> >>> here's a site: http://www.longbets.org/bets that takes socially >>> important predictions. I might have to enter one or two. >>> >>> i longed for such a accountable predictions for a long time. Usually, >>> some fucking fart will do predictions, but the problem is that it's not >> >> [...] >> >> OMG, he's back. >> >> I predict, Xah will haunt us for years to come. >> > >WTF is wrong with Xah? He posts an occasional article in good faith and >leaves it at that. ignoring the insults that follow. Apparently you've never actually read one of his articles. > >In the end we have one good-faith article and a bunch of personal >attacks from a Usenet chorus of self-appointed finger-shakers creating >more pollution than he ever did. > >If only some of the people castigating Xah for daring to use Usenet >would post as rarely as he, and show as much restraint. > Restraint? Now I know you haven't read it. -- Al Balmer Sun City, AZ -- http://mail.python.org/mailman/listinfo/python-list
Re: Xah's Edu Corner: accountability & lying thru the teeth
On Wed, 15 Feb 2006 04:55:33 GMT, Kenny Tilton <[EMAIL PROTECTED]> wrote: >> Apparently you've never actually read one of his articles. > >Have you read his web page? Like I did? Get back to me after you come up >to speed on Xah. Given the aspect he presents on Usenet, why on earth would I want to go to his web page? Why should I want to "come up to speed" on him? I have him filtered, have for a long time, and I can understand that it would be better if everyone filtered or ignored him, but I don't see posted complaints about him being any worse than your complaints about the complainers. I have no idea why anyone would defend such inane, worthless, obscenity-laced articles. -- Al Balmer Sun City, AZ -- http://mail.python.org/mailman/listinfo/python-list
GDI in python>?
hi, is it possible to address the 'screen pixels' using python , like analogous to older dos( functions that graphics.h provides') or win api calls for gdi. what i want is to display clusters (in differetn colours) on screen using python. thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: GDI in python>?
Thanks claudio, that should work out fine. -- http://mail.python.org/mailman/listinfo/python-list
suspected cPickle memory leak
I believe there is a memory leak in cPickle. I am using python2.2. I have a parallel code which uses array() and indices() from Numeric to massage data buffers before being sent and received by Pypar. Pypar subsequently uses cPickle to pickle the data. After many hours of execution, my code crashes with one of the following error messages (depending upon the run): a = zeros(shape, typecode, savespace) MemoryError: can't allocate memory for array or: s = dumps(x, 1) MemoryError: out of memory I have since modified my code to use a different data format so cPickle is no longer used from PyPar and now the code runs fine. -- Al Franz Computer Scientist Lawrence Livermore National Laboratory -- http://mail.python.org/mailman/listinfo/python-list
Re: Secret Technology of THERMATE and 911 Crime
[EMAIL PROTECTED] wrote: [snip crap] > I do not plan to make a career out of 9/11 research, [snip more crap] > We have found evidence for thermates in the molten metal seen pouring > from the South Tower minutes before its collapse, [snip still more crap] > Thermate is the red > powder in the steel base. The prototype worked well, and the thermate- > jet cut through a piece of structural steel in a fraction of a second. Google thermite 595,000 You can't even spell it correctly. If you wish to see the light, begin by pullng your head out of your ass, http://www.mazepath.com/uncleal/sunshine.jpg Idiot. You don't know dick about incendiaries. -- Uncle Al http://www.mazepath.com/uncleal/ (Toxic URL! Unsafe for children and most mammals) http://www.mazepath.com/uncleal/lajos.htm#a2 -- http://mail.python.org/mailman/listinfo/python-list
Re: ruby -> python translator exists?
On Dec 26, 8:31 pm, bearophileh...@lycos.com wrote: > rogerdpack: > > > Hi all. My name is Roger. > > Hello Roger, my name is bearophile. > > > Anybody know of a Ruby -> Python translator at all? I'm looking for a > > way to have my Ruby code take advantage of the coolio speed of Psyco. > > I have never heard of such translator, so far. > > > Also question. Does psyco work with Python 3.0? > > It doesn't work with Python3 and you may need lot of time to see it > come out... if you will ever see it. > > Bye, > bearophile Search for the tool "Unholy". -- Al -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI programming with python
In article <[EMAIL PROTECTED]>, Alan Franzoni <[EMAIL PROTECTED]> wrote: >zamil was kind enough to say: > >[cut] > >If your needs are very basic, you can stick with the tk module that comes >with python. It's not really feature-packed, but it's maintained and pretty >cross-platform. OK, what are my choices for an IDE/GUI development tool that runs on XP? Thanks -- Al Dykes News is something someone wants to suppress, everything else is advertising. - Lord Northcliffe, publisher of the Daily Mail -- http://mail.python.org/mailman/listinfo/python-list
Code example that will make a Skype connection?
Can some post a Python code fragment that will to make a PC with Skpye installed to make a Skype call, given a valid phone # string. I'm not asking for code that handles the audio once the connection is made. -- Al Dykes News is something someone wants to suppress, everything else is advertising. - Lord Northcliffe, publisher of the Daily Mail -- http://mail.python.org/mailman/listinfo/python-list
Re: Code example that will make a Skype connection?
In article <[EMAIL PROTECTED]>, nntpman68 <[EMAIL PROTECTED]> wrote: >Hi, > >Just some thoughts / now answer :-( > >The solution might vary on the platform / OS. > >Would it be acceptable for you to >control for example firefox from python and firefox would control skype >via the skype plugin. (should exist for multiple platforms) > >Do you search a native python solution or would you accept, that some >C-code had to be compiled. > Building a C module is fine as long as I don't have to debug it. I know that FF can do Skype so, I guess, if I write a Python app that runs in a browser, I've solved my problem. I'm about to learn Python, so I haven't given any thought to how to do that. Thanks for the response. What would be picked for a portable Firebox-based app? -- Al Dykes News is something someone wants to suppress, everything else is advertising. - Lord Northcliffe, publisher of the Daily Mail -- http://mail.python.org/mailman/listinfo/python-list
Re: Code example that will make a Skype connection?
In article <[EMAIL PROTECTED]>, Marco Bizzarri <[EMAIL PROTECTED]> wrote: >On Sat, Sep 13, 2008 at 4:09 PM, Al Dykes <[EMAIL PROTECTED]> wrote: >> >> Can some post a Python code fragment that will to make a PC with Skpye >> installed to make a Skype call, given a valid phone # string. >> >> I'm not asking for code that handles the audio once the connection is >> made. >> >> > >Maybe you can find this useful? > > >https://developer.skype.com/wiki/Skype4Py/examples/s4p_call_py > > >Regards >Marco Thanks for helping me get started. I'm new to Skype and Python. -- Al Dykes News is something someone wants to suppress, everything else is advertising. - Lord Northcliffe, publisher of the Daily Mail -- http://mail.python.org/mailman/listinfo/python-list
matrix algebra
Hi, My OS is Linux (openSUSE 10.3) and my interest in retirement is Python applications to Structural Analysis of Civil Engineering structures, currently in 2 dimensions only (under GPL). Modern Structural Analysis is highly matrix oriented, but requires only a few basic matrix operations, namely matrix creation, transposition, multiplication, invertion and linear equation solution. For stability analysis one would require Eigenvalues and Eigenvectors. In 3 dimensions, additionally highly desirable would be vector algebra. The packages do have all these functions, but currently only the basic functions are in the wrapper. There are several packages for matrix algebra. I tried Numeric, numpy and numarray. All three are very good, but each uses different syntax. Not a good thing for teaching... So I wrote a little python wrapper (under GPL) to unify all packages with the same simple and transparent syntax. Currently it deals with the Numeric, numpy and numarray and covers creation of zero filled matrices, transposition, matrix multiplication, solution of equations and inversion. This is a very active newsgroup that incudes such giants as Frederik Lundh and countless others. I wonder: 1. Is there any interest in matrix algebra "for the masses" (I mean interest in a wrapper for a subset of functions of the packages with a unified simple syntax)? 2. What other matrix operations would be required for your area of interest? 3. What other matrix packages, if any, should one include in the wrapper? A copy of the wrapper is stored in a small, public svn repository. If you would like to download it, please contact me by email at. Of course, if there is interest, I would be delighted to upload it to a generally accessible repository. Finally, if this is a re-invention of the wheel (which it may well be), would you kindly let me know? akabaila [at] pcug [dot] org [dot] au. I would be very happy to send you the checkout instructions, but I should discuss that with the people who run the repository. My home page that I quote with my signature is not a repository nor does it have the current programs. OldAl. -- Al Kabaila (Dr) http://akabaila.pcug.org.au/StructuralAnalysis -- http://mail.python.org/mailman/listinfo/python-list
Re: matrix algebra
Tim Leslie wrote: > There is no need for a wrapper. Both numarray and Numeric have been > deprecated in favour of numpy. Well, some years ago I looked for a matrix package. At that time it looked that numarray was the end of it all - it had a clean syntax, an active developer team. It looked to have everything that one could possibly wish. And here we are, it is fallen out of favour. It seems to me to be unwise to assume that in OSS there is the final, never to be superseded package for anything, including matrix algebra. OTH, I appreciate your reminder of SciPy. Thank you, Leslie. Michael Palmer wrote: > On Sep 22, 4:02 am, Al Kabaila <[EMAIL PROTECTED]> wrote: >> This is a very active newsgroup that incudes such giants as Frederik >> Lundh > > He looks rather small to me in this picture: > http://www.python.org/~guido/confpix/flundh-2.jpg Yes, indeed. However, I had in mind giants in informed writing on Python. Besides, it seems a custom to put in very old pictures in web publications. I do that myself, except that even in old pictures I am really, really old... I have a superseded paper version of Frederik Lundh's book "Python Standard Library", published by O'Reilly in May 2001. For Python that is a fair while back. Thanks for the link to the picture - appreciate it! OldAl. -- Al Kabaila (Dr) http://akabaila.pcug.org.au/StructuralAnalysis -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Love :)
Paddy wrote: > Spread the love - tell your Java freinds :-) well said paddy ! :-)) -- http://mail.python.org/mailman/listinfo/python-list
Re: How to schedule system calls with Python
Jorgen Grahn wrote: On Fri, 2009-10-16, Jeremy wrote: On Oct 15, 6:32 pm, MRAB wrote: TerryP wrote: On Oct 15, 7:42 pm, Jeremy wrote: I need to write a Python script that will call some command line programs (using os.system). I will have many such calls, but I want to control when the calls are made. I won't know in advance how long each program will run and I don't want to have 10 programs running when I only have one or two processors. I want to run one at a time (or two if I have two processors), wait until it's finished, and then call the next one. ... You could use multithreading: put the commands into a queue; start the same number of worker threads as there are processors; each worker thread repeatedly gets a command from the queue and then runs it using os.system(); if a worker thread finds that the queue is empty when it tries to get a command, then it terminates. Yes, this is it. If I have a list of strings which are system commands, this seems like a more intelligent way of approaching it. My previous response will work, but won't take advantage of multiple cpus/cores in a machine without some manual manipulation. I like this idea. Note that you do not need *need* multithreading for this. To me it seems silly to have N threads sitting just waiting for one process each to die -- those threads contribute nothing to the multiprocessing you want. In Unix, you can have one process fork() and exec() as many programs as you like, have them run on whatever CPUs you have, and wait for them to die and reap them using wait() and related calls. (Not sure what the equivalent is in non-Unix OSes or portable Python.) /Jorgen Another way to approach this, if you do want to use threads, is to use a counting semaphore. Set it to the maximum number of threads you want to run at any one time. Then loop starting up worker threads in the main thread. acquire() the semaphore before starting the next worker thread; when the semaphore reaches 0, your main thread will block. Each worker thread should then release() the semaphore when it exits; this will allow the main thread to move on to creating the next worker thread. This doesn't address the assignment of threads to CPU cores, but I have used this technique many times, and it is simple and fairly easy to implement. You have to make sure, though, that you catch all exceptions in the worker threads; if a thread exits without releasing the semaphore, you will have a "semaphore leak". And, of course, there are subtleties concerning threading that you always have to worry about, such as using a mutex, for instance, around any print statements so the various thread outputs don't mess each other up. -- http://mail.python.org/mailman/listinfo/python-list
Re: Strangeness: Cannot write to a file from a process created by Windows Task Scheduler ...
Do you "import time"? Sandy Walsh wrote: Hi there, Seeing some really weird behavior and perhaps someone has seen something similar: I have a python script that launches as a Windows Scheduled Task. The program simply opens a disk file and writes some text to it: --- f = open("waiting.txt", "w") x = 0 while 1: f.write("Sleeping: %d\r\n" % x) x += 1 time.sleep(2) f.close() --- I've run it under my user account. I've run it as Local Account. I've run it via pythonw and python ... only one way works: When I run with full credentials (not local account) and python (not pythonw) I get output in the file (and a CMD window appears while it's running). In every other combination it creates the 'waiting.txt' file, but doesn't write any output to the file. The length of the file is 0 bytes. Anyone have ideas what could be causing this? I suspect it's blocking on something, but I can't imagine where. There is no stderr/stdout output anywhere in the program so it's not blocking on anything stdio related (that I can imagine) Thoughts? -Sandy -- http://mail.python.org/mailman/listinfo/python-list
Re: Extracting patterns after matching a regex
Mart. wrote: On Sep 8, 4:33 pm, MRAB wrote: Mart. wrote: On Sep 8, 3:53 pm, MRAB wrote: Mart. wrote: On Sep 8, 3:14 pm, "Andreas Tawn" wrote: Hi, I need to extract a string after a matching a regular expression. For example I have the string... s = "FTPHOST: e4ftl01u.ecs.nasa.gov" and once I match "FTPHOST" I would like to extract "e4ftl01u.ecs.nasa.gov". I am not sure as to the best approach to the problem, I had been trying to match the string using something like this: m = re.findall(r"FTPHOST", s) But I couldn't then work out how to return the "e4ftl01u.ecs.nasa.gov" part. Perhaps I need to find the string and then split it? I had some help with a similar problem, but now I don't seem to be able to transfer that to this problem! Thanks in advance for the help, Martin No need for regex. s = "FTPHOST: e4ftl01u.ecs.nasa.gov" If "FTPHOST" in s: return s[9:] Cheers, Drea Sorry perhaps I didn't make it clear enough, so apologies. I only presented the example s = "FTPHOST: e4ftl01u.ecs.nasa.gov" as I thought this easily encompassed the problem. The solution presented works fine for this i.e. re.search(r'FTPHOST: (.*)',s).group(1). But when I used this on the actual file I am trying to parse I realised it is slightly more complicated as this also pulls out other information, for example it prints e4ftl01u.ecs.nasa.gov\r\n', 'FTPDIR: /PullDir/0301872638CySfQB\r\n', 'Ftp Pull Download Links: \r\n', 'ftp://e4ftl01u.ecs.nasa.gov/PullDir/ 0301872638CySfQB\r\n', 'Down load ZIP file of packaged order:\r\n', etc. So I need to find a way to stop it before the \r slicing the string wouldn't work in this scenario as I can envisage a situation where the string lenght increases and I would prefer not to keep having to change the string. If, as Terry suggested, you do have a tuple of strings and the first element has FTPHOST, then s[0].split(":")[1].strip() will work. It is an email which contains information before and after the main section I am interested in, namely... FINISHED: 09/07/2009 08:42:31 MEDIATYPE: FtpPull MEDIAFORMAT: FILEFORMAT FTPHOST: e4ftl01u.ecs.nasa.gov FTPDIR: /PullDir/0301872638CySfQB Ftp Pull Download Links: ftp://e4ftl01u.ecs.nasa.gov/PullDir/0301872638CySfQB Down load ZIP file of packaged order: ftp://e4ftl01u.ecs.nasa.gov/PullDir/0301872638CySfQB.zip FTPEXPR: 09/12/2009 08:42:31 MEDIA 1 of 1 MEDIAID: I have been doing this to turn the email into a string email = sys.argv[1] f = open(email, 'r') s = str(f.readlines()) To me that seems a strange thing to do. You could just read the entire file as a string: f = open(email, 'r') s = f.read() so FTPHOST isn't the first element, it is just part of a larger string. When I turn the email into a string it looks like... 'FINISHED: 09/07/2009 08:42:31\r\n', '\r\n', 'MEDIATYPE: FtpPull\r\n', 'MEDIAFORMAT: FILEFORMAT\r\n', 'FTPHOST: e4ftl01u.ecs.nasa.gov\r\n', 'FTPDIR: /PullDir/0301872638CySfQB\r\n', 'Ftp Pull Download Links: \r \n', 'ftp://e4ftl01u.ecs.nasa.gov/PullDir/0301872638CySfQB\r\n', 'Down load ZIP file of packaged order:\r\n', So not sure splitting it like you suggested works in this case. Within the file are a list of files, e.g. TOTAL FILES: 2 FILENAME: MOD13A2.A2007033.h17v08.005.2007101023605.hdf FILESIZE: 11028908 FILENAME: MOD13A2.A2007033.h17v08.005.2007101023605.hdf.xml FILESIZE: 18975 and what i want to do is get the ftp address from the file and collect these files to pull down from the web e.g. MOD13A2.A2007033.h17v08.005.2007101023605.hdf MOD13A2.A2007033.h17v08.005.2007101023605.hdf.xml Thus far I have #!/usr/bin/env python import sys import re import urllib email = sys.argv[1] f = open(email, 'r') s = str(f.readlines()) m = re.findall(r"MOD\.\.h..v..\.005\..\ \", s) ftphost = re.search(r'FTPHOST: (.*?)\\r',s).group(1) ftpdir = re.search(r'FTPDIR: (.*?)\\r',s).group(1) url = 'ftp://' + ftphost + ftpdir for i in xrange(len(m)): print i, ':', len(m) file1 = m[i][:-4] # remove xml bit. file2 = m[i] urllib.urlretrieve(url, file1) urllib.urlretrieve(url, file2) which works, clearly my match for the MOD13A2* files isn't ideal I guess, but they will always occupt those dimensions, so it should work. Any suggestions on how to improve this are appreciated. Suppose the file contains your example text above. Using 'readlines' returns a list of the lines: >>> f = open(email, 'r') >>> lines = f.readlines() >>> lines ['TOTAL FILES: 2\n', '\t\tFILENAME: MOD13A2.A2007033.h17v08.005.2007101023605.hdf\n', '\t\tFILESIZE: 11028908\n', '\n', '\t\tFILENAME: MOD13A2.A2007033.h17v08.005.2007101023605.hdf.xml\n', '\t\tFILESIZE: 18975\n'] Using 'str' on that list then converts it to s string _representation_ of that list: >>> str(lines) "['TOTAL FILES: 2\\n', '\\t\\tFILENAME: MOD13A2.A2007033.h17v08.005.2007101023605.hdf\\n', '\\t\\tFILESIZE: 11028908\\n', '\\n', '\\t\\tFILENAME: MOD13A2.A2007033.h17v08.005.20071010236
Is there a way to creat a func that returns a cursor that can be used?
Is there a way to create a func that returns a cursor that can be used to execute sql statements? I tried this (after importing sqlite3), but it gave me the error below: >>> def connect(): conn = sqlite3.connect(':memory:')#use sch3.db or sch4.db etc. cur = conn.cursor() cur.execute("create table schedule (teams integer, sn integer, badge integer ,name text, grp integer,\ major text, track text, stage text, tc text, subject text, course text, ws text, date text, \ time text, proctor text, code text, no integer,fl_time text, flag2 text, flag3 text, flag4 text, clash1 integer, clash2 integer)") return cur >>> connect() >>> cur.execute("select * from schedule") Traceback (most recent call last): File "", line 1, in cur.execute("select * from schedule") NameError: name 'cur' is not defined -- http://mail.python.org/mailman/listinfo/python-list
Jobs for developers
Hi There, We are looking to hire talented developers to join different teams.. The candidate should be willing to move to Dubai, United Arab Emirates. The developer must have: 1. Experience in OOP. 2. Strong algorithm thinking. 3. average SQL database design skills. 4. Experience dealing with an MVC framework such as Symfony, Django, RoR or others is a plus. 5. Experience in Python is a plus. 6. Previous experience in a low level programming language such as Java, C++, C# is a huge bonus. 7. Web development experience is a huge bonus. The candidate should be self motivated, love to learn and up for bigger challenges every day. Environment is fast moving and highly demanding. It's a publishing company and being on time and target is the most important factor in what we do plus we push so hard to implement the right design patterns in everything we do. The candidate should be able to think fast and find creative solutions fast while still go for the highest performance solution (fastest algorithms- lowest complexity ) and be able to work with a highly knowledgable team to share and think together. Everyone who joins our team learn so much because it's a company of 600 highly creative individuals and we are up to compete in the market in all of our products so you must be able to work under pressure and enjoy growing in experience and grow with us. If you are up for the journey please email your CV to r...@itpshare.com Visa, insurance, tickets, etc. are all provided. Salary is TBD. ** -- http://mail.python.org/mailman/listinfo/python-list
Python reading and writing
Why doesn't this code work? http://pastebin.com/A3Sf9WPu -- https://mail.python.org/mailman/listinfo/python-list
Re: Python reading and writing
Thanks man. -- https://mail.python.org/mailman/listinfo/python-list
pgs4a fails to build
Hi everyone. So I have this problem with building with pgs4a. when I try to build I always end with this error: /home/aws/Desktop/pgs4a-0.9.6/android-sdk/tools/ant/build.xml:483: SDK does not have any Build Tools installed. could you please help me? Thank you in advance. -- https://mail.python.org/mailman/listinfo/python-list
Re: pgs4a fails to build
Yes I've followed and installed everything -- https://mail.python.org/mailman/listinfo/python-list
Megawidget Syntax (Tix)
I'm new to Python*. I am having trouble with the Tix NoteBook megawidget. When I use a simpler megawidget, such as a ButtonBox, I can add buttons by invoking .add ('button3', text='Retry') Unfortunately, with the Notebook, I need access to a subwidget, and all my attempts have led to error messages. When I try to look up the megawidget documentation, I can only find example in Tcl, so I'm confident that if someone explains the syntax of the TixNoteBook megawidget to me, I should be able to figure it out for all the other megawidgets on my own. Here's an attempt to add something to the hlist subwidget: >>> lnotebook.hlist.add ('wrongsyntax') Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\lib-tk\Tix.py", line 863, in add return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) _tkinter.TclError: invalid command name ".12204992.pane.p1.shlist.f1.hlist" *I evaluated it many years ago (1996) when the only other choices seemed to be Perl, Tcl, and VB. Unfortunately, my various employers chose which scripting language would be used, and none of them ever chose Python. Oddly, I ended up using all of the others. -- http://mail.python.org/mailman/listinfo/python-list
Working with Widget after Instance loses the reference
I made the mistake of creating an instance of a widget and assigning it to a name I'd already used. Now, if I use root.children or root.slaves(), I can see the "lost" widget, but can I do anything else with the string of numbers that shows up when I use root.children? I'd like to destory the widget, for example. it would be even better if I could create a new name and have it reference the "lost" widget. Of course, I can just kill my toplevel and start over. -- http://mail.python.org/mailman/listinfo/python-list
Re: Working with Widget after Instance loses the reference
John McMonagle wrote: > On Mon, 2006-07-31 at 11:15 -0700, Al in Dallas wrote: [example of "losing" a widget] > Consider the following code run in the python shell: > > >>> from Tkinter import * > >>> r = Tk() > >>> b1 = Button(r, text='test') > >>> b1.pack() > >>> b2 = Button(r, text='test2') > >>> b2.pack() > >>> r.children > {'-1210160564': , '-1210225748': > } > >>> r.slaves() > [, 0xb7de6a4c>] > >>> b1 = 'xxx' > >>> b1.destroy() > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'str' object has no attribute 'destroy' > >>> b1 = r.slaves()[0] > >>> b1.destroy() > >>> > > > So, as long as you know what your widget instance is in root.slaves() or > root.children you can assign it to a new name. Since I've been leaving my shell open, I jumped in and tried: recoveredlabel = root.slaves()[6] And after I verified I could manipulate the widget with that name, I executed: = recoveredlabel Now the only difference between where I was (before I screwed up) and where I am is that I've got this extra variable named "recoveredlabel." Thanks. Now, do you have any advice on learning the syntax for dealing with Tix megawidgets in Python? I guess my alternative is to learn how to use Elmer or SWIG so I can hide all the Python I've inherited "under the hood" and write my GUI in Tcl/Tk. -- http://mail.python.org/mailman/listinfo/python-list
Re: Megawidget Syntax (Tix)
Al in Dallas wrote: > I'm new to Python*. I am having trouble with the Tix NoteBook > megawidget. When I use a simpler megawidget, such as a ButtonBox, I can > add buttons by invoking > > .add ('button3', text='Retry') > > Unfortunately, with the Notebook, I need access to a subwidget, and all > my attempts have led to error messages. When I try to look up the > megawidget documentation, I can only find example in Tcl, so I'm > confident that if someone explains the syntax of the TixNoteBook > megawidget to me, I should be able to figure it out for all the other > megawidgets on my own. Here's an attempt to add something to the hlist > subwidget: > > >>> lnotebook.hlist.add ('wrongsyntax') > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\lib\lib-tk\Tix.py", line 863, in add > return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) > _tkinter.TclError: invalid command name > ".12204992.pane.p1.shlist.f1.hlist" > > *I evaluated it many years ago (1996) when the only other choices > seemed to be Perl, Tcl, and VB. Unfortunately, my various employers > chose which scripting language would be used, and none of them ever > chose Python. Oddly, I ended up using all of the others. Well, I've found a partial answer for a slightly less complicated megawidget: >>> nbpage1 = notebook.add ('first',label="First") >>> nbpage2 = notebook.add ('second',label="Second") >>> notebook.pages() [, ] >>> notebook.subwidget_list {'nbframe': , 'second': , 'first': } >>> nblab = Tix.Label(nbpage1,text="Test First Tab") >>> nblab.pack() >>> nbbtn = Tix.Button(nbpage2,text="Test Second Tab") >>> nbbtn.pack() >>> nbbbox = Tix.ButtonBox(nbpage1) >>> nbbbox.add ('nbbxb1',text='Yeah!') '.12236560.nbframe.first.12237760.nbbxb1' >>> nbbbox.pack() >>> nbbbox.add ('nbbxb2',text='Nah...') '.12236560.nbframe.first.12237760.nbbxb2' >>> nbp2lab1 = Tix.Label(nbpage2,text='This is the second most\ncomplicated widg et that has been mastered\nCome over some day maybe play poker') >>> >>> nbp2lab1.pack() I still don't have ListNoteBook widgets sussed, but I'm on the road. -- http://mail.python.org/mailman/listinfo/python-list
socket.error: (32, 'Broken pipe'): need help
Hi, I have a simple server-client application with threading. It works fine when both server and client on the same machine, but I get the following error message if the server is on another machine: ... ... self.socket.send(outgoingMsg) socket.error: (32, 'Broken pipe') I do not know where to start with? Thanks Junhua -- http://mail.python.org/mailman/listinfo/python-list
Changing the Keyboard output
Hi, I am new to Python and still learning. I am looking for a way to change the keyboard output within Tkinter - for example, say I press "p" and I want to come out as "t". Could anyone point me in the right direction? AHaM -- http://mail.python.org/mailman/listinfo/python-list
Python based silent installer, how to?
Hi All, I'm using many python based packages (ex. bzr-2.4.1-1.win32-py2.6.exe) inside my installer. How can I install them silently in Windows? PS Most installers has arguments for silent installation ex. NSIS based installers has /S argument but I didn't find any reference for python based installers -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
Re: Python based silent installer, how to?
On 20/10/2011 01:35 ص, Alec Taylor wrote: Just download the msi (script is available to regenerate yourself) and run it with the silent swtich, something like: msiexec /x nameofmsi.msi Sorry I didn't explain what I'm looking for exactly. I've packages built by bdist_wininst, Is there any way for install them silently? Or is there any way for convert them to another format (ex. msi) in that way I can install them silently. -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
Re: Python based silent installer, how to?
On 20/10/2011 12:00 ص, Steven D'Aprano wrote: Please don't send raw HTML (so-called "rich text") to mailing lists. It makes it very difficult for some people to read. If you must use HTML, please ensure your email client or news reader also sends a plain text version of the message as well. Sorry I forgot to configure my Thunderbird. That will depend on what your installer is, and whether it has an option for silent installation. Your question is unclear. What is the connection between Python and the installer? "I am installing Python on Windows." "Python is already installed, and I'm installing extra Python packages, using many different installers." "I'm installing applications using an installer written in Python." "I'm writing my own installer, using Python." or something else? If you want a better answer, you will need to explain what you are doing in more detail. I've packages built by bdist_wininst, Is there any way for install them silently? Or is there any way for convert them to another format (ex. msi) in that way I can install them silently. PS I tried to unzip that packages (I thought I may re-package un-zipped packages by NSIS or something else) and I discovered that the structure of directories of bdist_wininst packages so different! for example: ---xlwt-0.7.2.win32.exe--- PURELIB | |-- xlwt-0.7.2-py2.5.egg-info |-+ xlwt |-+ doc |-+ examples |-- __init__.py |-- antlr.py . . ---bzr-2.3.4-1.win32-py2.6.exe--- DATA |-- Doc PLATLIB | |-- bzr-2.3.4-py2.6.egg-info |-+ bzrlib |-+ bundle |-+ doc |-- __init__.py |-- _annotator_py.py . . SCRIPTS | |-- bzr |-- bzr-win32-bdist-postinstall.py -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
Re: Python based silent installer, how to?
On 20/10/2011 12:12 م, Tim Golden wrote: If you can get the source (specifically including the setup.py which I don't think is included in the wininst .zip) then you can use that to build an msi: python setup.py bdist_msi which you can then manage via the usual msiexec switches. It's often available from the same source as the wininst .exe and/or from the project's code repository. In case I got .egg file (ex. http://pypi.python.org/pypi/setuptools/0.6c11) from some website, can I use it as alternative to bdist_wininst package? In case 'yes' where I've to put .egg file? -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
encoding issue (cp720)
Hi All, I'm still a newbie in Python (I started learn it yesterday) and I faced a huge problem cuz python always crashes because of encoding issue! Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: cp720 so I filed a bug report <http://bugs.python.org/issue86...@ok_message=msg%20105576%20created%3cbr%3eissue%208693%20message_count%2c%20messages%20edited%20ok&@template=item> about it but I couldn't find a solution for this problem so could you please help me to run python correctly? *Note:* * I'm using: Windows XP SP3 32Bit, Python 3.1.2 * I tried to copy cp720.py <http://svn.python.org/view/python/trunk/Lib/encodings/cp720.py> to Python31\Lib\encodings but it didn't fix the issue and gives me an error message (see attachment plz) -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net Fatal Python error: Py_Initialize: can't initialize sys standard streams Traceback (most recent call last): File "C:\Python31\lib\encodings\__init__.py", line 98, in search_function level=0) File "C:\Python31\lib\encodings\cp720.py", line 50 u'\x00' # 0x00 -> CONTROL CHARACTER ^ SyntaxError: invalid syntax This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.-- http://mail.python.org/mailman/listinfo/python-list
Re:[SOLVED] encoding issue (cp720)
Hi Lie, On 12/05/2010 12:14 م, Lie Ryan wrote: On 05/12/10 18:43, M. Bashir Al-Noimi wrote: Hi All, I'm still a newbie in Python (I started learn it yesterday) and I faced a huge problem cuz python always crashes because of encoding issue! Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: cp720 so I filed a bug report <http://bugs.python.org/issue86...@ok_message=msg%20105576%20created%3cbr%3eissue%208693%20message_count%2c%20messages%20edited%20ok&@template=item> about it but I couldn't find a solution for this problem so could you please help me to run python correctly? This is partly a locale issue; your terminal (command prompt) is using a locale yet unsupported by python. You can use 'chcp' to switch to different terminal code page (e.g. use chcp 1250). You won't be able to 'print' arabic characters, but at least python should run. Actually I tried to run chcp (some one mentioned it in bug report) but it didn't fix the issue. *Note:* * I'm using: Windows XP SP3 32Bit, Python 3.1.2 * I tried to copy cp720.py <http://svn.python.org/view/python/trunk/Lib/encodings/cp720.py> to Python31\Lib\encodings but it didn't fix the issue and gives me an error message (see attachment plz) You're using Python 3.1, the cp720.py file you copied is for Python 2.7 (trunk); there are some backward incompatible between python 2 and python 3 (specifically in your case, unicode string is now default in python 3, so unicode literal is no longer supported). Try using the cp720.py from py3k branch: http://svn.python.org/view/python/branches/py3k/Lib/encodings/cp720.py?view=markup Thanks a lot python currently works this is the right file. -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net -- http://mail.python.org/mailman/listinfo/python-list