python-fedex 1.0 Released
python-fedex 1.0 has been released. This GPLv3 module is a very light wrapper around the excellent suds SOAP module and FedEx's Web Services WSDLs. The purpose of this module is to prepare the WSDL objects for the user to populate and manipulate as needed, as well as handling sending and light processing for common errors. python-fedex leaves the user to read FedEx's documentation to understand all of the fields exposed by python-fedex. Requirements: * Python 2.5+, but not 3.0 * suds (https://fedorahosted.org/suds/) Download: http://code.google.com/p/python-fedex/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
PyPy Sprint Announcement, Duesseldorf 6 Nov- 13 Nov
Düsseldorf PyPy sprint November 6 - November 13 2009 = The next PyPy sprint will be held in the Computer Science department of Heinrich-Heine Universität Düsseldorf from the 6th to the 13th of November 2009. This is a fully public sprint, everyone is welcome to join us. Topics and goals At the sprint we intend to work on the JIT generator in PyPy and on applying it to PyPy Python interpreter. The precise work that will be done is not fixed, as we don't know in which state the JIT will be in November. However, possible areas of work might include: - tweaking the interpreter/objspace to be more JIT-friendly, e.g. instance implementation code, call code - if there is interest starting non x86-32 JIT backends - trying out existing software to find features where the optimizations of the JIT could be improved - improving our benchmarking infrastructure We will give special priority to topics that non-core people find interesting (as long as they are somehow JIT-related). For an introduction of how our JIT-generation process works, please refer to our blog: http://morepypy.blogspot.com/2009/03/jit-bit-of-look-inside.html There is also a more dense academic paper about the subject: http://codespeak.net/svn/pypy/extradoc/talk/icooolps2009/bolz-tracing-jit-final.pdf Location The sprint will take place in a seminar room of the computer science department. It is in the building 25.12 of the university campus. For travel instructions see http://stups.cs.uni-duesseldorf.de/anreise/esbahn.php Registration If you'd like to come, please subscribe to the `pypy-sprint mailing list`_ and drop a note about your interests and post any questions. More organisational information will be send to that list. We'll keep a list of `people`_ which we'll update (which you can do so yourself if you have codespeak commit rights). .. _`pypy-sprint mailing list`: http://codespeak.net/mailman/listinfo/pypy-sprint .. _`people`: http://codespeak.net/pypy/extradoc/sprintinfo/ddorf2009/people.txt -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
New mds-utils release (1.1.0)
I'm proud to announce a new release of mds-utils (http://code.google.com/p/mds-utils/). New release features: 1) flush support added to FILE* devices. 2) added a new python namespace. Contains an object derived from boost::python::object that helps in using python file objects within python extensions written with Boost.Python. What is mds-utils ? -- It's a C++ library composed by different utilities. Amongst its features it contains classes to treat a FILE* as a C++ stream. It contains also some utilities for developing C++ Python extensions. For more information, go to the library site (http://code.google.com/p/mds-utils/) -- Michele De Stefano http://www.linkedin.com/in/micdestefano http://xoomer.virgilio.it/michele_de_stefano -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: Albow 2.1
ALBOW - A Little Bit of Widgetry for PyGame Version 2.1 is now available. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/ Highlights of this version: * OpenGL faciliites * Music facilities * Drop-down menus and menu bars What is Albow? Albow is a library for creating GUIs using PyGame that I have been developing over the course of several PyWeek competitions. I am documenting and releasing it as a separate package so that others may benefit from it, and so that it will be permissible for use in future PyGame entries. The download includes HTML documentation and some example programs demonstrating most of the library's features. You can also see some screenshots and browse the documentation on-line. -- Gregory Ewing greg.ew...@canterbury.ac.nz -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Distributing Python-programs to Ubuntu users
Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list
Re: Poll: Do you use csv.Sniffer?
On Sep 25, 2:00 pm, Alex_Gaynor alex.gay...@gmail.com wrote: On Sep 24, 10:26 pm, s...@pobox.com wrote: If you are a csv module user, I have a question for you: Do you use the csv.Sniffer class? I just used it yesterday :) Not having it would mean I'd need to add another dependency to my project so that I can import data from my client (it's easier to reexport his Excel spreadsheets as CSV and import that), that's not the end of the world, but what's the argument against leaving it in the stdlib? Why do you need the sniffer? If your client can't do save as the same way twice, just read the spreadsheets directly! -- http://mail.python.org/mailman/listinfo/python-list
Crypto and export laws
I'm trying to get a handle on how python intersects with crypto-related export control laws in the US and elsewhere. My current understanding, per the PSF's wiki, is that any crypto related and potentially export-sensitive code is in the ssl wrapper, and that, in fact, this only links to the actual encryption implementation (presumably libssl or something.) One caveat is that windows installations may include the ssl implementation. Does this effectively sum up python's exposure to export laws? On a technical level, does removing the ssl module from a distribution remove all references to encryption? Of course I'm not asking for actual legal advice, but can anyone think of any other part of the code that might run afoul of export rules? Thanks. Austin -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Thursday, 24 September 2009 15:42:36 Antoine Pitrou wrote: Grant Edwards invalid at invalid.invalid writes: Back when I worked on one of the first hand-held cellular mobile phones, it used co-routines where the number of coroutines was fixed at 2 (one for each register set in a Z80 CPU). Gotta love the lightning-fast EXX instruction. :-) Using it in the above context is about equivalent to slipping a hand grenade in amongst the other eggs in a nest. :-) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Hello, I recommend you to check this: https://wiki.ubuntu.com/PackagingGuide/Complete The best way to release the software to Ubuntu users is by means of a PPA (https://help.launchpad.net/Packaging/PPA) so that people can track your application updates automatically. Before the PPA is created you need to have a launchpad account and a sign the Ubuntu Code of Conduct. However isn't that hard and you just have to do all this setup for the first time. A tool that might be used to automate package creation for an application is Quickly (https://wiki.ubuntu.com/Quickly). However, if the project development has already started, probably it won't be useful for you. Best regards, Javier 2009/9/25 Olof Bjarnason olof.bjarna...@gmail.com: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
On Friday 25 September 2009 08:15:18 Olof Bjarnason wrote: Does anyone have any hint on a more economic way of creating single-file distribution packages You could use distutils (setup.py) and include a readme that explains what apt-get commands to use to install pygame, etc. Generally it's better to *not* include the kitchen-sink with your apps; rather expect the user to have those libraries already or be able to fetch them with ease. I did my best at explaining that deeply confusing setup.py process here: http://wiki.python.org/moin/Distutils/Tutorial I have also seen two other approaches: 1. A new app called 'Quickly' which is some kind of magical auto-do- everything-ubuntu connected to Launchpad. From what I hear it sounds very cool. https://wiki.ubuntu.com/DesktopTeam/Specs/Karmic/Quickly 2. The Ubuntu PPA repositories -- google around. (Seems Quickly does this too) hth, \d -- home: http://otherwise.relics.co.za/ 2D vector animation : https://savannah.nongnu.org/projects/things/ Font manager : https://savannah.nongnu.org/projects/fontypython/ -- http://mail.python.org/mailman/listinfo/python-list
Re: DBHandler class for logging?
With a similar requirement, I made a small logging tool (usable as handler) which logs into nearly every DB (including Postgres - thanks to the SQLAlchemy library.) It has BSD license. You may use it (or parts of the code): http://www.reifenberg.de/rrlog/ (It does some more things you may not need, like rotation handling.) Regards, Nebur -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Maybe the distutils list is more adapted for this question: The Zope community uses zc.sourcerelease to build rpm http://www.mail-archive.com/distutils-...@python.org/msg06599.html Buildout is said to have undocumented features to build packages. Tarek Ziade is working debian package with 'distribute'. Cheers, On Fri, Sep 25, 2009 at 8:15 AM, Olof Bjarnason olof.bjarna...@gmail.com wrote: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list -- Rasterization Zion babylon -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
2009/9/25 Jean Daniel jeandaniel.bro...@gmail.com: Maybe the distutils list is more adapted for this question: Yes The Zope community uses zc.sourcerelease to build rpm http://www.mail-archive.com/distutils-...@python.org/msg06599.html Buildout is said to have undocumented features to build packages. Tarek Ziade is working debian package with 'distribute'. Thanks Jean! Cheers, On Fri, Sep 25, 2009 at 8:15 AM, Olof Bjarnason olof.bjarna...@gmail.com wrote: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list -- Rasterization Zion babylon -- twitter.com/olofb olofb.wordpress.com olofb.wordpress.com/tag/english -- http://mail.python.org/mailman/listinfo/python-list
Re: Read header and data from a binary file [LONG]
En Tue, 22 Sep 2009 18:18:16 -0300, Jose Rafael Pacheco jose_rafael_pach...@yahoo.es escribió: Hello, I want to read from a binary file called myaudio.dat Then I've tried the next code: import struct name = myaudio.dat f = open(name,'rb') f.seek(0) chain = 4s 4s I 4s I 20s I I i 4s I 67s s 4s I s = f.read(4*1+4*1+4*1+4*1+4*1+20*1+4*1+4*1+4*1+4*1+4*1+67*1+1+4*1+4*1) a = struct.unpack(chain, s) Easier: fmt = struct.Struct(chain) s = f.read(fmt.size) a = fmt.unpack(s) The audio data length is 300126, now I need a clue to build an array with the audio data (The Chunk SDA_), would it possible with struct?, any help ? The chunk module (http://docs.python.org/library/chunk.html) is designed to work with such file format. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Poll: Do you use csv.Sniffer?
Why do you need the sniffer? If your client can't do save as the same way twice, just read the spreadsheets directly! If I only had one contact and one client, it would be this easy...If you can get multiple points of contact at multiple client sites to reliably competently agree on a format, what are you doing here on c.l.py instead of making your billions as a business-integration consultant? ;-) -tkc -- http://mail.python.org/mailman/listinfo/python-list
Python und Referenzen auf Variablen?
Hallo, ich möchte im Speicher eine verschachtelte Struktur aufbauen in der dict()s und list()s verwendet werden und tief ineinander verschachtelt sind. D.h. mehrere lists und dicts können jeweils wieder lists und dicts enthalten. Ich möchte als Einträge hauptsächlich int, float und string verwenden, ich muß aber auch Referenzen auf die anderen Einträge eintragen können, die vom Programm anders behandelt werden müssen. Die Schlüssel der dict()s werden sich vermutlich nicht mehr ändern wenn sie einmal zugewiesen sind. Die Indizes der list()s können sich zur Laufzeit allerdings schon ändern, wenn z.B. aus einer list() ein Eintrag gelöscht wird. Der nachfolgende Eintrag würde dann nachrücken und sich damit sein Index ändern. Wie könnte ich in so einer verschachtelten Struktur Referenzen abbilden? Viele Grüße, Torsten. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python und Referenzen auf Variablen?
Hi, this list is english only. I won't translate for you as I think you wouldn't be happy with it - as you can't read the recommendations - if you don't speak english. In that case you might want to try python...@python.net) (die Liste ist eigentlich nur english, ich übersetze das mal nicht, da du mit englischen antworten nicht glücklich sein wirst. Kurzes google hat mich zu python...@python.net geführt falls du lieber auf Deutsch unterwegs bist) 2009/9/25 Torsten Mohr tm...@s.netic.de: Hallo, ich möchte im Speicher eine verschachtelte Struktur aufbauen in der -- http://www.xing.com/profile/Martin_Marcher http://www.linkedin.com/in/martinmarcher You are not free to read this message, by doing so, you have violated my licence and are required to urinate publicly. Thank you. Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Olof Bjarnason olof.bjarna...@gmail.com writes: I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. As a program developer, you should be less concerned with the specifics of any particular distribution, and aim first to make your work easily adopted by those with motivation for that particular distribution. This goal is made easier for program developers by standards and specifications aimed at that purpose. A major one is the Filesystem Hierarchy Standard URL:http://www.pathname.com/fhs/, and desktop application programs should comply with the relevant specifications at URL:http://www.freedesktop.org/wiki/Specifications. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Right. A major benefit of the Debian (and hence Ubuntu) operating system is a detailed, comprehensive policy on how to package the works for integration with the whole operating system, and strict enforcement of that policy. That benefit comes at a cost: Packaging the work in such a way that it complies with the Debian policy requires a certain amount of study and discipline, and so is not a task that you should take on lightly. It's often much better to form a relationship with someone who knows the topic well who is also motivated to package your software. That person (or group) becomes the “maintainer” of your work in Debian, and as you have noted has a big enough job as it is. Likewise for Ubuntu, Fedora, etc. to the extent that the distribution has such a packaging policy. Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. Such tools do exist, but in my opinion they do more harm than good. Their results cannot be anywhere near as suitable as the result of someone who knows both your specific work and the relevant policy. Better to lay solid groundwork by conforming firstly to the distribution-agnostic specifications. A sufficiently useful program that is also conformant with relevant standards will be highly attractive to skilled packagers, and they will be grateful to not have to fight against your work to get it to integrate properly. -- \ “There is something wonderful in seeing a wrong-headed majority | `\ assailed by truth.” —John Kenneth Galbraith, 1989-07-28 | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
lxml and xmlsec
Hi! Anyone know if it is possible to use xmlsec together with lxml ? -- Roland -- http://mail.python.org/mailman/listinfo/python-list
Re: Crypto and export laws
Austin Bingham wrote: I'm trying to get a handle on how python intersects with crypto-related export control laws in the US and elsewhere. My current understanding, per the PSF's wiki, is that any crypto related and potentially export-sensitive code is in the ssl wrapper, and that, in fact, this only links to the actual encryption implementation (presumably libssl or something.) One caveat is that windows installations may include the ssl implementation. Does this effectively sum up python's exposure to export laws? On a technical level, does removing the ssl module from a distribution remove all references to encryption? Of course I'm not asking for actual legal advice, but can anyone think of any other part of the code that might run afoul of export rules? Thanks. Here's a summary: * Python uses OpenSSL in the ssl module and the hashlib module. * hashlib falls back to its own implementations of the md5 and sha algorithms. * ssl doesn't work without OpenSSL installed on the system. * The Windows intaller of Python ships with the OpenSSL libs. * The only Python module that actually contained crypto code was the rotor module (implementing an enigma-style cipher), but that was removed a long time ago. Depending on how close a country follows the Wassenaar Arrangement (http://www.wassenaar.org/) OpenSSL, Python and all other open-source software falls under the GENERAL SOFTWARE NOTE part 2.: The Lists do not control software which is either: 1. ... 2. In the public domain. If you're shipping a closed-source product that includes OpenSSL, then you'd have to follow the rules in category 5 part 2 of the dual-use list: http://www.wassenaar.org/publicdocuments/index_CL.html However, some countries add some extra requirements to the WA dual-use list, so you need check those as well. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 25 2009) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ -- http://mail.python.org/mailman/listinfo/python-list
Re: iterate over list while changing it
iterate over a copy of the list: for i, x in enumerate(a[:]): Always worked for me ;) -- http://mail.python.org/mailman/listinfo/python-list
can i use the browser to show the result of python
I have write some python script i want to use browser(IE or FF) to call it, an show the returns! how to? -- http://mail.python.org/mailman/listinfo/python-list
Re: Poll: Do you use csv.Sniffer?
On 25/09/2009 7:04 PM, Tim Chase wrote: Why do you need the sniffer? If your client can't do save as the same way twice, just read the spreadsheets directly! If I only had one contact and one client, it would be this easy...If you can get multiple points of contact at multiple client sites to reliably competently agree on a format, what are you doing here on c.l.py instead of making your billions as a business-integration consultant? ;-) Because like everyone else, I can't get the same contact at the same site to do the same thing twice in a row :-( My point is that save as CSV is (a) a potentially lossy process and (b) an unnecessary step when you can read straight from the XLS file. -- http://mail.python.org/mailman/listinfo/python-list
Re: Date using input
flebber.c...@gmail.com wrote: I don't think I am using re.compile properly, but thought as this would make my output an object it would be better for later, is that correct? #Obtain date def ObtainDate(date): date = raw_input(Type Date dd/mm/year: ) re.split('[/]+', date) date year = date[-1] month = date[1] day = date[0] re.compile('year-month-day') You persist in top-posting (putting your reply ahead of the sequence of messages you're quoting). Regular expressions are an advanced technique. You need to learn how strings work, how names clash, how functions return values. Learn how the fundamental types can be manipulated before messing with datetime module, or re module. As I said in an earlier message: Do you understand what kind of data is returned by raw_input() ? If so, look at the available methods of that type, and see if there's one called split() that you can use to separate out the multiple parts of the user's response. You want to separate the dd from the mm and from the year. You've done the same with the more complex and slower re module. You could have just used the code I practically handed you: date_string = raw_input(Type Date dd/mm/year: ) date_list = datestring.split(/) Then, you have correctly parsed the list into separate string variables. Easier would have been: day, month, year = date_list or just combining the last two lines: day, month, year = date_string.split(/) Now you'd like to put them together in a different order, with a different separator. The re module doesn't do that, but again, you don't need it. Look up str.join(), which is pretty much the inverse of split, or simply look up how to concatenate strings with the + operator. Now, consider the calling and return of that function. What are you using the formal parameter date for? Why is it even there? And what value are you intending to return? Try writing one complete script, complete with a single definition, and a single call to that definition, perhaps printing the result calling that definition. Master chapters 1-3 before jumping to chapter 12. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding application data after install - a solution?
On Fri, Sep 25, 2009 at 02:24 -0300, Gabriel Genellina wrote: En Thu, 24 Sep 2009 08:21:59 -0300, Wolodja Wentland How do *you* deal with application data in your programs? Is there a way that works on as many platforms as possible? On linux, using a configuration file like /etc/fooapplication.conf On Windows, using a registry key under HKEY_LOCAL_MACHINE\Software\My Bussiness Name\Foo Application. In either place, there is an entry pointing to the actual directory where data is stored. How do you you *install* this file within /etc ? Do users have to copy it themselves into /etc from DATA_DIR/foo/etc/fooapplication.conf.sample ? I never had the problem you want to solve, probably I'm just lucky (or perhaps my users are geek enough to know how to edit a config file, or dumb enough to never change the system settings...) I am just trying to support all installation schemes supported by distutils. That's all ;-) so long Wolodja signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: PExpect on Windows System Using Cygwin
Sean DiZazzo wrote: On Sep 24, 4:37 pm, Dave Angel da...@ieee.org wrote: snip Why not just use the subprocess module? It's built into the Windows distribution, and doesn't need cygwin. DaveA Can subprocess pass things like passwords to running processes like pexpect can? ~Sean I don't know what pexpect is/was capable of, since it's not apparently part of the current Python distributions. I thought it had the ability to fork or spawn a child process, with pipes connected. Anyway, subprocess can launch a new process, with pipes optionally connected back to your code. I don't think it can attach to an already-running process. There are things in pywin32 that might help (even for controlling GUI programs), but I suspect there'd be a big learning curve. And of course it'd then be very Windows-dependent. pywin32 - http://python.net/crew/skippy/win32/Downloads.html or get it as part of the ActiveState python distro. http://www.activestate.com/activepython/ DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: can i use the browser to show the result of python
Hacken wrote: I have write some python script i want to use browser(IE or FF) to call it, an show the returns! how to? You don't say much about your environment, nor the nature of your script. So my response will be very generic. If your script writes a valid html/xml/xhtml format to stdout, then you could put the script onto a web server with cgi enabled, and mark it executable. Then you could enter the URL for that cgi file into your browser, and see that generated web page. Interesting additional gotchas: You need rights to upload (ftp) to such a server. The server needs to have an appropriate Python available, and configured to permit cgi access for files with the .py extension. Further, if the server is Unix, your file must be in Unix text format, with a shebang line that matches the location of the appropriate version of python on that particular server. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
On 25 Sep, 08:15, Olof Bjarnason olof.bjarna...@gmail.com wrote: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! If you start simple and don't have to produce extension modules, it's not too bad, but finding all the right tools is an awkward task. I'm not sure that I've really mastered the craft yet. Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. You could take a look at this PyGame project: http://www.infukor.com/rally7.html The sources contain packaging infrastructure for Debian/Ubuntu, and you could certainly adapt that for your own purposes. Paul -- http://mail.python.org/mailman/listinfo/python-list
problems trying to build python 2.6 as a shared library
Hi All, I'm trying to build Python 2.6 as a shared library, so I did: ./configure --enable-shared make make altinstall No obvious signs of failure, but when I try and use the resulting python, I get: python2.6: error while loading shared libraries: libpython2.6.so.1.0: cannot open shared object file: No such file or directory Why might that be? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
2009/9/25 Paul Boddie p...@boddie.org.uk: On 25 Sep, 08:15, Olof Bjarnason olof.bjarna...@gmail.com wrote: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! If you start simple and don't have to produce extension modules, it's not too bad, but finding all the right tools is an awkward task. I'm not sure that I've really mastered the craft yet. Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. You could take a look at this PyGame project: http://www.infukor.com/rally7.html Thanks this might come in handy. The sources contain packaging infrastructure for Debian/Ubuntu, and you could certainly adapt that for your own purposes. Paul -- http://mail.python.org/mailman/listinfo/python-list -- twitter.com/olofb olofb.wordpress.com olofb.wordpress.com/tag/english -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
On 25 Sep, 09:26, Donn donn.in...@gmail.com wrote: You could use distutils (setup.py) and include a readme that explains what apt-get commands to use to install pygame, etc. Generally it's better to *not* include the kitchen-sink with your apps; rather expect the user to have those libraries already or be able to fetch them with ease. The various package installers and dpkg will probably complain about missing packages, but one could go all the way and set up a repository which works with apt-get. I did something elementary of this nature with some Shed Skin packages: http://packages.boddie.org.uk/ There will undoubtedly be things I haven't quite done right here, but it would give a reasonable installation experience, although there would need to be a number of packages available through the repository for the configuration exercise to be worthwhile. I did my best at explaining that deeply confusing setup.py process here:http://wiki.python.org/moin/Distutils/Tutorial This is a nice tutorial, and I'll have to see if I can contribute anything to it later. I have also seen two other approaches: 1. A new app called 'Quickly' which is some kind of magical auto-do- everything-ubuntu connected to Launchpad. From what I hear it sounds very cool.https://wiki.ubuntu.com/DesktopTeam/Specs/Karmic/Quickly 2. The Ubuntu PPA repositories -- google around. (Seems Quickly does this too) The problem with some Ubuntu stuff, sadly, is that the maintainers like to have their own special toolset which isolates them from the more general Debian ways of working. In addition, Launchpad, despite its recent open-sourcing (in most respects), is perceived as something of a walled garden. Still, if it contributes good ideas to the mainstream, I suppose it's not all bad. Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
2009/9/25 Paul Boddie p...@boddie.org.uk: On 25 Sep, 09:26, Donn donn.in...@gmail.com wrote: You could use distutils (setup.py) and include a readme that explains what apt-get commands to use to install pygame, etc. Generally it's better to *not* include the kitchen-sink with your apps; rather expect the user to have those libraries already or be able to fetch them with ease. The various package installers and dpkg will probably complain about missing packages, but one could go all the way and set up a repository which works with apt-get. I did something elementary of this nature with some Shed Skin packages: http://packages.boddie.org.uk/ There will undoubtedly be things I haven't quite done right here, but it would give a reasonable installation experience, although there would need to be a number of packages available through the repository for the configuration exercise to be worthwhile. I did my best at explaining that deeply confusing setup.py process here:http://wiki.python.org/moin/Distutils/Tutorial This is a nice tutorial, and I'll have to see if I can contribute anything to it later. I have also seen two other approaches: 1. A new app called 'Quickly' which is some kind of magical auto-do- everything-ubuntu connected to Launchpad. From what I hear it sounds very cool.https://wiki.ubuntu.com/DesktopTeam/Specs/Karmic/Quickly 2. The Ubuntu PPA repositories -- google around. (Seems Quickly does this too) The problem with some Ubuntu stuff, sadly, is that the maintainers like to have their own special toolset which isolates them from the more general Debian ways of working. In addition, Launchpad, despite its recent open-sourcing (in most respects), is perceived as something of a walled garden. Still, if it contributes good ideas to the mainstream, I suppose it's not all bad. Paul -- http://mail.python.org/mailman/listinfo/python-list Thanks for you answers. I am thinking of two target audiences: 1. Early adopters/beta-testers. This would include: - my non-computer-geek brother on a windows-machine. I'll go for py2exe. - any non-geek visiting my blog using windows (py2exe) - any geeks visiting my blog that use Ubuntu (tell them about the PPA-system) - any geeks visiting my blog that are non-Ubuntu (i'll just provide the source code and tell them to apt-get python-pygame) 2. Future players - I'll try to find people that want me to help package the game for different OSs. This list might come in handy ;) -- twitter.com/olofb olofb.wordpress.com olofb.wordpress.com/tag/english -- http://mail.python.org/mailman/listinfo/python-list
Re: problems trying to build python 2.6 as a shared library
On Sep 25, 1:08 pm, Chris Withers ch...@simplistix.co.uk wrote: Hi All, I'm trying to build Python 2.6 as a shared library, so I did: ./configure --enable-shared make make altinstall No obvious signs of failure, but when I try and use the resulting python, I get: python2.6: error while loading shared libraries: libpython2.6.so.1.0: cannot open shared object file: No such file or directory Why might that be? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting -http://www.simplistix.co.uk Hello Chris, The dynamic loader cannot find the python shared library. There are at least 2 options: 1. Add path that contains the shared library to the LD_LIBRARY_PATH environment variable. In a bash shell this can be accomplished by: export LD_LIBRARY_PATH=/path/to/python_shared_lib: $LD_LIBRARY_PATH 2. Add path to dynamic linker configuration file. This typically is in '/etc/ld.so.conf'. See man page for ld for more information. Note that I assumed that you are on a Unix/Linux machine. Regards, Marco -- http://mail.python.org/mailman/listinfo/python-list
Re: problems trying to build python 2.6 as a shared library
Marco Nawijn wrote: The dynamic loader cannot find the python shared library. There are at least 2 options: 1. Add path that contains the shared library to the LD_LIBRARY_PATH environment variable. In a bash shell this can be accomplished by: export LD_LIBRARY_PATH=/path/to/python_shared_lib: $LD_LIBRARY_PATH 2. Add path to dynamic linker configuration file. This typically is in '/etc/ld.so.conf'. See man page for ld for more information. 3. Set LD_RUN_PATH before you link the shared library or use the -rlink option of the linker, see man(1) ld. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Evaluate coding and style
Rhodri James wrote: On Thu, 24 Sep 2009 21:11:36 +0100, Brown, Rodrick rodrick.br...@citi.com wrote: I recently started playing with Python about 3 days now (Ex Perl guy) and wanted some input on style and structure of what I'm doing before I really start picking up some bad habits here is a simple test tool I wrote to validate home dirs on my system. Ethan's made some good points. Here are a couple more. [snip] try: fh = open(filename) except IOError: print No such filename: %s % (filename) [snip] It's is usually a bad idea to loose information when giving feedback to the user. try: fh = open(filename) except IOError, exception: print Error openning %s : % (filename, exception) In general, if you want to improve your coding style/rules, read PEP 8 and this page : http://tottinge.blogsome.com/meaningfulnames/ This is a must read (yet you still can disagree). Regarding this, fh = open(filename) would become fileHandler = open(fileName) Much nicer to read :o) These are just suggestions, cheers. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Crypto and export laws
M.-A. Lemburg m...@egenix.com (M-L) wrote: M-L Depending on how close a country follows the Wassenaar M-L Arrangement (http://www.wassenaar.org/) OpenSSL, Python M-L and all other open-source software falls under the M-L GENERAL SOFTWARE NOTE part 2.: M-L M-L The Lists do not control software which is either: M-L 1. ... M-L 2. In the public domain. M-L M-L If you're shipping a closed-source product that includes M-L OpenSSL, then you'd have to follow the rules in category 5 M-L part 2 of the dual-use list: M-L http://www.wassenaar.org/publicdocuments/index_CL.html But Python is not in the public domain. Open source != public domain. Public domain means there is no copyright and no license attached to it, AFAIK. -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list
Re: PExpect on Windows System Using Cygwin
On Fri, Sep 25, 2009 at 6:09 AM, Dave Angel da...@ieee.org wrote: Sean DiZazzo wrote: On Sep 24, 4:37 pm, Dave Angel da...@ieee.org wrote: snip Why not just use the subprocess module? It's built into the Windows distribution, and doesn't need cygwin. DaveA Can subprocess pass things like passwords to running processes like pexpect can? ~Sean I don't know what pexpect is/was capable of, since it's not apparently part of the current Python distributions. I thought it had the ability to fork or spawn a child process, with pipes connected. Anyway, subprocess can launch a new process, with pipes optionally connected back to your code. I don't think it can attach to an already-running process. There are things in pywin32 that might help (even for controlling GUI programs), but I suspect there'd be a big learning curve. And of course it'd then be very Windows-dependent. pywin32 - http://python.net/crew/skippy/win32/Downloads.html or get it as part of the ActiveState python distro. http://www.activestate.com/activepython/ DaveA -- http://mail.python.org/mailman/listinfo/python-list Thanks for the suggestions. My script is already written and works great with PExpect as long as I run it in my cygwin environment. My question I think is better suited to a cygwin list actually as I am hoping that I can simply move the appropriate .dll's up to the server without actually installing cygwin on the server. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Format string with single quotes in it
Hi there, My question is simple, but I've been spending some hours over the web and still struggling to get this right: How do I format a string that contains single quotes in it? I am reading a file with lines of the form: CONT%d_VIRTMEM_REGIONS 'Container %d number of virtual regions' and trying to format this as follows: str % (0, 0) I get the error: ValueError: unsupported format character ' ' (0xa) at index 5541 I also tried: # Replace single quotes with \' str = str.replace(', \') and doubling the backward slash as well. What am I doing wrong? Thank you, Bahadir -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Olof Bjarnason olof.bjarna...@gmail.com writes: - any geeks visiting my blog that are non-Ubuntu (i'll just provide the source code and tell them to apt-get python-pygame) Note that for several years now the recommended command-line tool for package installation is not ‘apt-get’, but ‘aptitude’ [0]. Compatible command-line interface, uses the same back-end library and package system, but many improvements in behaviour; especially the distinction between manually-requested packages versus automatically-installed packages that can be later removed when they're no longer needed. [0] URL:http://www.debian.org/doc/manuals/reference/ch02.en.html#_basic_package_management_operations -- \“The problem with television is that the people must sit and | `\keep their eyes glued on a screen: the average American family | _o__) hasn't time for it.” —_The New York Times_, 1939 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Crypto and export laws
Piet van Oostrum wrote: M.-A. Lemburg m...@egenix.com (M-L) wrote: [ ... ] M-L M-L The Lists do not control software which is either: M-L 1. ... M-L 2. In the public domain. M-L [ ... ] But Python is not in the public domain. Open source != public domain. Public domain means there is no copyright and no license attached to it, AFAIK. I believe that public domain has different meanings in copyright law and in crypto law. In crypto law I think it means generally available, in that it's silly to impose import or export restrictions on something that's already obtainable everywhere. Mel. -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
2009/9/25 Ben Finney ben+pyt...@benfinney.id.au: Olof Bjarnason olof.bjarna...@gmail.com writes: - any geeks visiting my blog that are non-Ubuntu (i'll just provide the source code and tell them to apt-get python-pygame) Note that for several years now the recommended command-line tool for package installation is not ‘apt-get’, but ‘aptitude’ [0]. Compatible command-line interface, uses the same back-end library and package system, but many improvements in behaviour; especially the distinction between manually-requested packages versus automatically-installed packages that can be later removed when they're no longer needed. Great thanks for this info. I just tried running it on a vanilla Ubuntu system, and it is there. Most tutorials on the web still (I've read mostly Ubuntu-related forums) mention apt-get; seems like an error? [0] URL:http://www.debian.org/doc/manuals/reference/ch02.en.html#_basic_package_management_operations -- \ “The problem with television is that the people must sit and | `\ keep their eyes glued on a screen: the average American family | _o__) hasn't time for it.” —_The New York Times_, 1939 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list -- twitter.com/olofb olofb.wordpress.com olofb.wordpress.com/tag/english -- http://mail.python.org/mailman/listinfo/python-list
Re: Format string with single quotes in it
On Fri, Sep 25, 2009 at 10:42 PM, Bahadir bilgehan.bal...@gmail.com wrote: Hi there, My question is simple, but I've been spending some hours over the web and still struggling to get this right: How do I format a string that contains single quotes in it? I don't know what you're doing wrong, but I've tried both Python 2.6.2 and 3.1.1, and the following worked perfectly for me: a = Mrra%d 'Mrraa!!%d' a %(1,2) Mrra1 'Mrraa!!2' Maybe if you share a snippet of the code, or do more actual testing that might help? Good luck, Xav -- http://mail.python.org/mailman/listinfo/python-list
Re: Format string with single quotes in it
Bahadir bilgehan.bal...@gmail.com wrote in message news:65b6ce03-62c7-4e56-a746-d85ce87ad...@l31g2000vbp.googlegroups.com... Hi there, My question is simple, but I've been spending some hours over the web and still struggling to get this right: How do I format a string that contains single quotes in it? I am reading a file with lines of the form: CONT%d_VIRTMEM_REGIONS 'Container %d number of virtual regions' and trying to format this as follows: str % (0, 0) I get the error: ValueError: unsupported format character ' ' (0xa) at index 5541 I also tried: # Replace single quotes with \' str = str.replace(', \') and doubling the backward slash as well. What am I doing wrong? A short, working example that exhibits the problem would be helpful, but I suspect you have a line in your file that ends in a %. The code below produces the same error. s = Here's a percentage: %d%\n print s % (0,0) OUTPUT: Traceback (most recent call last): File C:\dev\python\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py, line 436, in ImportFile my_reload(sys.modules[modName]) File w.py, line 2, in module print s % (0,0) ValueError: unsupported format character ' ' (0xa) at index 24 Inspect your input file. If you want a percent sign in a format string, use %%. s = Here's percentages: %d%% %d%%\n print s % (0,0) OUTPUT: Here's percentages: 0% 0% -Mark -- http://mail.python.org/mailman/listinfo/python-list
IDE for python similar to visual basic
-- Forwarded message -- From: J Sisson sisso...@gmail.com To: Nobody nob...@nowhere.com Date: Thu, 24 Sep 2009 19:18:03 -0500 Subject: Re: IDE for python similar to visual basic On Sun, Sep 13, 2009 at 6:25 AM, Nobody nob...@nowhere.com wrote: On Fri, 11 Sep 2009 05:27:59 -0700, r wrote: Sounds like somebody failed to get input from their users at design time. Or somebody has the inability to relate to their end users. You're assuming that there is some right answer which is appropriate for all users. There isn't. I worked for a company that had a team composed of graphic artists, QA types, etc...that did nothing but draw up GUI's, show them to customers, revise them, write up runnable dummies of the approved GUI's, performed usability studies with our customers using the dummy GUI's, and finally handed the GUI's over to dev so they could put in the guts to make it do stuff. Bugs or Cases involving the GUI needing revision because a button needed to be moved for usability were *extremely* rare, and the GUI didn't require an additional toolset that allowed end users to tweak them. My favorite IDE : Eclipse http://pydev.org/download.html http://www.ibm.com/developerworks/opensource/library/os-eclipse-visualstudio http://www.eclipse.org Of course you have also the Mono: http://monodevelop.com Cheers.|:0), -- http://mail.python.org/mailman/listinfo/python-list
Re: Format string with single quotes in it
On 25 Sep, 13:42, Bahadir bilgehan.bal...@gmail.com wrote: Hi there, My question is simple, but I've been spending some hours over the web and still struggling to get this right: How do I format a string that contains single quotes in it? I am reading a file with lines of the form: CONT%d_VIRTMEM_REGIONS 'Container %d number of virtual regions' and trying to format this as follows: str % (0, 0) Don't call variables 'str' as it'll mask the builtin string type. I get the error: ValueError: unsupported format character ' ' (0xa) at index 5541 Index 5541!? I would guess the lines in the file aren't quite what you think. The message you're receiving suggests you've got a % character, followed by a linefeed character -- are you opening the file in text mode, if not, do so... and if your file has mixed newline sequences, try using the universal newline option: infile = open ('filename','rU'). I also tried: # Replace single quotes with \' str = str.replace(', \') and doubling the backward slash as well. None of that is needed AFAICT. What am I doing wrong? Thank you, Bahadir In summary: j...@jon-desktop:~$ cat test.txt line 1 SOMELINE%d and some value of %d line 2 SOMELINE%d and some value of %d line 3 SOMELINE%d and some value of %d line 4 SOMELINE%d and some value of %d j...@jon-desktop:~$ cat test.py for line in open('test.txt'): print line.rstrip('\n') % (0, 0) j...@jon-desktop:~$ python test.py line 1 SOMELINE0 and some value of 0 line 2 SOMELINE0 and some value of 0 line 3 SOMELINE0 and some value of 0 line 4 SOMELINE0 and some value of 0 hth, Jon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Olof Bjarnason olof.bjarna...@gmail.com writes: Most tutorials on the web still (I've read mostly Ubuntu-related forums) mention apt-get; seems like an error? Not quite an error (since ‘apt-get’ continues to work), just habit of old-timers, and cargo-cult administration by newcomers. -- \“Science doesn't work by vote and it doesn't work by | `\authority.” —Richard Dawkins, _Big Mistake_ (The Guardian, | _o__) 2006-12-27) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Poll: Do you use csv.Sniffer?
On Sep 24, 10:26 pm, s...@pobox.com wrote: If you are a csv module user, I have a question for you: Do you use the csv.Sniffer class? o Yes, frequently o Yes, on occasion o I tried it a few times but don't use it now o No, I don't need it o No, never heard of it o No (some other reason) If you don't use it, how do you figure out the structure of your csv files? o I just know o I stumble around in the dark trying different parameters until the csv reader starts to spit out useful data If csv.Sniff was to be removed from a future version of Python, how difficult would it be to adapt? o No problem o No problem as long as you make it available via PyPI o It would be a problem If it would be a problem for you (which would not easily be solved by adding it to PyPI), feel free to describe why it would be a challenge for you. In fact, please feel free to add any other comments you like to your response. Private replies please. Thanks, -- Skip Montanaro - s...@pobox.com -http://www.smontanaro.net/ Getting old sucks, but it beats dying young Do you use the csv.Sniffer class? No. Don't use it right now. how do you figure out the structure of your csv files? head -2 filename + visual inspection + guesswork If csv.Sniff was to be removed from a future version of Python, how difficult would it be to adapt? No problem. It would still be nice if the code was available somewhere on the net. -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Ben Finney ben+pyt...@benfinney.id.au writes: Olof Bjarnason olof.bjarna...@gmail.com writes: Most tutorials on the web still (I've read mostly Ubuntu-related forums) mention apt-get; seems like an error? Not quite an error (since ‘apt-get’ continues to work), just habit of old-timers, and cargo-cult administration by newcomers. It also appears that the installed software advises it, e.g.: p...@sleeper-service:~$ sbcl The program 'sbcl' is currently not installed. You can install it by typing: sudo apt-get install sbcl bash: sbcl: command not found -- http://mail.python.org/mailman/listinfo/python-list
Re: Intercepting binding?
On Sep 24, 5:39 am, andrew cooke and...@acooke.org wrote: It's significant, depressing, and not at all surprising that every person who replied to this thread told me, in one way or another, that was I was asking was wrong or impossible or foolhardy. People on this list are volunteers, who have no obligation to help. If you want always friendly, enabling advice I'm sure there are good support services out there who would be happy not to second-guess you for a fee. Otherwise, grow thicker skin. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
ANN: Albow 2.1
ALBOW - A Little Bit of Widgetry for PyGame Version 2.1 is now available. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/ Highlights of this version: * OpenGL faciliites * Music facilities * Drop-down menus and menu bars What is Albow? Albow is a library for creating GUIs using PyGame that I have been developing over the course of several PyWeek competitions. I am documenting and releasing it as a separate package so that others may benefit from it, and so that it will be permissible for use in future PyGame entries. The download includes HTML documentation and some example programs demonstrating most of the library's features. You can also see some screenshots and browse the documentation on-line. -- Gregory Ewing greg.ew...@canterbury.ac.nz -- http://mail.python.org/mailman/listinfo/python-list
Re: Crypto and export laws
Ben Finney ben+pyt...@benfinney.id.au (BF) wrote: BF Piet van Oostrum p...@cs.uu.nl writes: But Python is not in the public domain. Open source != public domain. BF One always needs to be aware of what bizarro-world definitions these BF legalese documents are using for terms we might normally understand. BF However, in this case it seems fairly sane and : BF GTN In the public domain BF GSN This means technology or software which has been made BF available BF ML 22 without restrictions upon its further dissemination. BF URL:http://74.125.153.132/search?q=cache:t8kUZpvsUncJ:www.wassenaar.org/controllists/2008/WA-LIST%2520(08)%25201/16%2520-%2520WA-LIST%2520(08)%25201%2520-%2520DEF.doc+%22definitions+of+terms+used+in+these+lists%22cd=1hl=enct=clnkie=UTF-8 Yes, I found that a few minutes ago, in between my cooking preparations :=) Public domain means there is no copyright and no license attached to it, AFAIK. BF More accurately, it generally refers to a work with no copyright holder BF and hence no license *needed* by anyone to perform acts normally BF reserved to a copyright holder. BF So free software still held under copyright is not “in the public BF domain” by the above definition. BF In any case, the part that seems to apply clearly to Python is this one: BF GENERAL SOFTWARE NOTE BF The Lists do not control software which is either: BF 1. Generally available to the public by being: BF a. Sold from stock at retail selling points without restriction, BF by means of: BF 1. Over-the-counter transactions; BF 2. Mail order transactions; BF 3. Electronic transactions; or BF 4. Telephone call transactions; and BF b. Designed for installation by the user without further BF substantial support by the supplier; BF URL:http://74.125.153.132/search?q=cache:oUPbVxp4coMJ:www.wassenaar.org/controllists/2008/WA-LIST%2520(08)%25201/02%2520-%2520WA-LIST%2520(08)%25201%2520-%2520GTN%2520and%2520GSN.doc+general+note+softwarecd=1hl=enct=clnkie=UTF-8 BF Python is certainly generally available, by being sold as described BF above (as well as other means), and with no further substantial support BF from the supplier. BUT: then it continues to state that the above does not apply to cryptographic software. At least that's how I interpret the following sentence: Note Entry 1 of the General Software Note does not release software controlled by Category 5 - Part 2 (Information Security). except that Category 5 - Part 2 makes some exceptions. BF So AFAICT, the Wassenaar Arrangement on export controls explicitly BF excludes Python (and most widely-sold free software) by the “generally BF available to the public by being sold from stock at retail” definition. I had heard of the WA before (if only because I live in the same country) but never looked into it. So does this mean that the export of crypto software (with the exceptions above) is not allowed from European countries either? I.e. that we in Europe have been infected with these stupid USA export laws, maybe in a milder form? -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Crypto and export laws
Piet van Oostrum p...@cs.uu.nl writes: But Python is not in the public domain. Open source != public domain. One always needs to be aware of what bizarro-world definitions these legalese documents are using for terms we might normally understand. However, in this case it seems fairly sane and : GTN In the public domain GSN This means technology or software which has been made available ML 22 without restrictions upon its further dissemination. URL:http://74.125.153.132/search?q=cache:t8kUZpvsUncJ:www.wassenaar.org/controllists/2008/WA-LIST%2520(08)%25201/16%2520-%2520WA-LIST%2520(08)%25201%2520-%2520DEF.doc+%22definitions+of+terms+used+in+these+lists%22cd=1hl=enct=clnkie=UTF-8 Public domain means there is no copyright and no license attached to it, AFAIK. More accurately, it generally refers to a work with no copyright holder and hence no license *needed* by anyone to perform acts normally reserved to a copyright holder. So free software still held under copyright is not “in the public domain” by the above definition. In any case, the part that seems to apply clearly to Python is this one: GENERAL SOFTWARE NOTE The Lists do not control software which is either: 1. Generally available to the public by being: a. Sold from stock at retail selling points without restriction, by means of: 1. Over-the-counter transactions; 2. Mail order transactions; 3. Electronic transactions; or 4. Telephone call transactions; and b. Designed for installation by the user without further substantial support by the supplier; URL:http://74.125.153.132/search?q=cache:oUPbVxp4coMJ:www.wassenaar.org/controllists/2008/WA-LIST%2520(08)%25201/02%2520-%2520WA-LIST%2520(08)%25201%2520-%2520GTN%2520and%2520GSN.doc+general+note+softwarecd=1hl=enct=clnkie=UTF-8 Python is certainly generally available, by being sold as described above (as well as other means), and with no further substantial support from the supplier. So AFAICT, the Wassenaar Arrangement on export controls explicitly excludes Python (and most widely-sold free software) by the “generally available to the public by being sold from stock at retail” definition. -- \ “What you have become is the price you paid to get what you | `\ used to want.” —Mignon McLaughlin | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Twisted PB: returning result as soon as ready
In the following chunk of code the CLIENT receives both the results from “compute” at the same time (i.e. when the second one has finished). This way it cannot start “elaborateResult” on the first result while the SERVER is still running the second “compute”. How could I get the first result as soon as ready and therefore parallelize things? thanks, Jacopo SERVER: fibo=Fibonacci() fact=pb.PBServerFactory(fibo) reactor.listenTCP(port, fact) reactor.run() CLIENT: fact=pb.PBClientFactory() reactor.connectTCP(host, port, fact) d=fact.getRootObject() n1=1 d.addCallback(lambda obj: obj.callRemote(compute, n1)) d.addCallback(elaborateResult) d2=fact.getRootObject() n2=1 d2.addCallback(lambda obj: obj.callRemote(compute, n2)) d2.addCallback(elaborateResult) reactor.run() -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On 2009-09-25, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Thursday, 24 September 2009 15:42:36 Antoine Pitrou wrote: Grant Edwards invalid at invalid.invalid writes: Back when I worked on one of the first hand-held cellular mobile phones, it used co-routines where the number of coroutines was fixed at 2 (one for each register set in a Z80 CPU). Gotta love the lightning-fast EXX instruction. :-) Using it in the above context is about equivalent to slipping a hand grenade in amongst the other eggs in a nest. EXX accomplised much of the context switch operation. I don't remember how much RAM was available, but it wasn't much... -- Grant Edwards grante Yow! And furthermore, at my bowling average is visi.comunimpeachable!!! -- http://mail.python.org/mailman/listinfo/python-list
is this whiff/wsgi claim true?
Hi folks. I just modified the WHIFF concepts index page http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts To include the following paragraph with a startling and arrogant claim in the final sentence :) Developers build WHIFF applications much like they build static web content, PHP applications, JSP pages, or ASP pages among others -- the developer drops files into a directory, and the files are automatically used to respond to URLs related to the filename. **This intuitive and ubiquitous approach to organizing web components is not automatically supported by other WSGI infrastructures.** [I go on to illustrate the concept with examples...] Is the final sentence true? Are there other WSGI approach which make deploying a dynamic page as easy as putting an HTML file in a static directory? If I'm lying I'd like to correct the statement and my knowledge of what else is out there is faulty and incomplete, so please correct me. Thanks, -- Aaron Watters === less is more -- http://mail.python.org/mailman/listinfo/python-list
Re: is this whiff/wsgi claim true?
On Sep 25, 4:26 pm, Aaron Watters aaron.watt...@gmail.com wrote: Hi folks. I just modified the WHIFF concepts index page http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts To include the following paragraph with a startling and arrogant claim in the final sentence :) Developers build WHIFF applications much like they build static web content, PHP applications, JSP pages, or ASP pages among others -- the developer drops files into a directory, and the files are automatically used to respond to URLs related to the filename. **This intuitive and ubiquitous approach to organizing web components is not automatically supported by other WSGI infrastructures.** [I go on to illustrate the concept with examples...] Is the final sentence true? Are there other WSGI approach which make deploying a dynamic page as easy as putting an HTML file in a static directory? If I'm lying I'd like to correct the statement and my knowledge of what else is out there is faulty and incomplete, so please correct me. Thanks, -- Aaron Watters To me, it looks like the approach Quixote used long before the coming of WSGI (see http://www.quixote.ca/learn/1 How Quixote Works). M.S. -- http://mail.python.org/mailman/listinfo/python-list
importing with .m instead of .py
I would like to import Matlab/Octave files of the .m sort into Python that look like this. # comment y=[1,2,3,4,5\ ,6,7,8,9]; # comment The only problem is I have to change the extensions from .m to .py. Is there a way to get python to import files that don't end in .py? Thank you -- http://mail.python.org/mailman/listinfo/python-list
Re: IDE for python similar to visual basic
Threader Slash wrote: -- Forwarded message -- From: J Sisson sisso...@gmail.com To: Nobody nob...@nowhere.com Date: Thu, 24 Sep 2009 19:18:03 -0500 Subject: Re: IDE for python similar to visual basic On Sun, Sep 13, 2009 at 6:25 AM, Nobody nob...@nowhere.com wrote: On Fri, 11 Sep 2009 05:27:59 -0700, r wrote: Sounds like somebody failed to get input from their users at design time. Or somebody has the inability to relate to their end users. You're assuming that there is some right answer which is appropriate for all users. There isn't. I worked for a company that had a team composed of graphic artists, QA types, etc...that did nothing but draw up GUI's, show them to customers, revise them, write up runnable dummies of the approved GUI's, performed usability studies with our customers using the dummy GUI's, and finally handed the GUI's over to dev so they could put in the guts to make it do stuff. Bugs or Cases involving the GUI needing revision because a button needed to be moved for usability were *extremely* rare, and the GUI didn't require an additional toolset that allowed end users to tweak them. My favorite IDE : Eclipse http://pydev.org/download.html http://www.ibm.com/developerworks/opensource/library/os-eclipse-visualstudio http://www.eclipse.org Of course you have also the Mono: http://monodevelop.com Cheers.|:0), But where's the GUI designer for Eclipse/Python? That's what the OP was asking about. GUI builders I've heard of, but not evaluated include: Boa wxGlade wxFormBuilder Wing IDE DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
exar...@twistedmatrix.com (e) wrote: e I specifically left out all yield statements in my version, since that's e exactly the point here. :) With real coroutines, they're not necessary - e coroutine calls look just like any other call. With Python's enhanced e generators, they are. The first time I encountered coroutines was in Simula-67. Coroutine switching was certainly explicit there. IIRC, the keyword was resume. -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] surprised to ++ and --
(Moving this to python-list where it should have been in the first place).) As pointed out, var++ and var-- are syntax errors, however several similar expressions are legal. These, however, are not interpreted as the C++ increment and decrement operators, but rather as a binary operator followed by a unary operator or two unary operators. ++a, --a, a++b, a--b are all legal and interpreted as +(+a), -(-a), a+(+b), and a-(-b). Could it be from one of these that the OP formed his (mistaken) idea? Gary Herron Facundo Batista wrote: 2009/9/23 Wee Binn weeb...@gmail.com: I know that there is no ++ or -- operator in python, but if var++ or something like that in my code(you know, most of C/C++ coders may like this),there is nothing wrong reported and program goes on just like expected!! This is obscure, maybe a bug. You can not write var++: var = 5 var++ File ipython console, line 1 var++ ^ SyntaxError: invalid syntax -- http://mail.python.org/mailman/listinfo/python-list
ANNOUNCE libmsgque 3.5, ANNOUNCE (P)rogramming (L)anguage (M)icro(K)ernel 1.0
Dear Users; this is the ANNOUNCEMENT of: libmsgque 3.5 and the *first* public ANNOUNCEMENT of the: (P)rogramming (L)anguage (M)icro(K)ernel 1.0 libmsgque 3.5 = LibMsgque is an OS independent, programming language independent, and hardware independent solution to link applications together to act like a single application. In other words, LibMsgque is an application-server toolkit. changes from libmsgque 3.5 === - Add new programming language C++ : The new language is added if the --enable-cxx configure switch is used. - C++ add a new design pattern to libmsgque based on the language requirements: 1. In C++ a constructor can not call a virtual method. This is the main difference between C++ and C# or JAVA. This require that Object creation/deletion and Link creation/deletion have to be separated into two different tasks. The former (C# and JAVA) implementation was to use a feature-rich constructor to setup a Link during object creation. This was changed. A new methods LinkCreate(..) and LinkCreateChild(..) were introduced for Link setup as counterpart for the LinkDelete() method. A new method ConfigGetIsConnected() return the Link-Status of the Object-Instance. With the new Pattern it is now possible to reuse a object-instance. 2. In C++ a RTTI based Object-Creation is not possible. This task was shifted into a Factory pattern. A virtual method called: virtual MqC* Factory() const is used to return a new object instance of the top-most class. The Factory pattern was used as default design pattern because of: - far more easy as the RTTI design pattern - available for every programming language - change the default visibility for GCC functions to hidden - fvisibility=hidden. - This support the Windows binary design on Linux to create faster code. - redesign of the main struct MqS and delete many of the data pointers - create smarter and faster code - only *one* pointer is used to used the entire API - the Filter mode was redesigned and is using the Master/Slave pattern - code cleanup and standardization - the IFilterFTR / IFilterEOF does now support a pipelining as default - the Error handling was redesigned and moved into an independent object or class. This was necessary to transport an error through the error stack of the embedded programming language. (P)rogramming (L)anguage (M)icro(K)ernel 1.0 JAVA says: YOU can do whatever YOU want on every os YOU require but YOU have to use JAVA C# says: YOU can do whatever YOU want on every os YOU require but YOU have to have to use a CLR compatible language I say: YOU can do whatever YOU want on every os YOU require using the programming language YOU like most but YOU have to use the PLMK design pattern The PLMK is an afford to shift the design responsible away from the very heteros group of language designers to a free open and mature framework called PLMK. This framework is available for C, C++, C#, JAVA, PYTHON and TCL and was designed as C/C++ shared library. The library is able to plugin into the hosting programming language to take-over the responsibly for the application design. PLMK is *not* a programming language, the software programming is done using the hosting programming language *only*. - libmsgque is the first component of the PLMK framework - GET IT read more at: http://libmsgque.sourceforge.net/ get the software from:http://sourceforge.net/projects/libmsgque/ subversion archive: https://libmsgque.svn.sourceforge.net/svnroot/ /libmsgque/tags/libmsgque-3.5/ mfg aotto1968 -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Sep 23, 11:53 pm, exar...@twistedmatrix.com wrote: I specifically left out all yield statements in my version, since that's exactly the point here. :) With real coroutines, they're not necessary - coroutine calls look just like any other call. Personally, I like the yield. I understand that being forced to rewrite code to insert the yield is ugly, but the yield makes clear that the control flow is special. In Scheme there is no syntactic distinction between ordinary function calls and continuation calls, but they are quite different since continuation do not return (!). I always thought this is was a wart of the language, not an advantage. -- http://mail.python.org/mailman/listinfo/python-list
Re: importing with .m instead of .py
Wanderer wrote: I would like to import Matlab/Octave files of the .m sort into Python that look like this. # comment y=[1,2,3,4,5\ ,6,7,8,9]; # comment The only problem is I have to change the extensions from .m to .py. Is there a way to get python to import files that don't end in .py? Thank you Hi, (untested:) read the .m file as a string, then evaluate the string (see eval()) in appropriate context? success! bye -- http://mail.python.org/mailman/listinfo/python-list
New books: Learning Python, Python Pocket Reference 4th Eds
I'm happy to announce new, 4th editions of the O'Reilly books Learning Python and Python Pocket Reference. These new editions have been thoroughly updated and expanded to cover both Python 3.1 and 2.6, and fully present features that appear in each Python line. Whether you're using Python 2.X, using Python 3.X, or stuck somewhere in between, you'll find these editions tailored to your current and future needs. In addition to language changes, the new Learning Python has been augmented with a new OOP tutorial chapter, as well as new advanced topic chapters that explore Unicode processing, managed attributes, decorators, and metaclasses. For a more detailed description of the changes in the new Learning Python, please see the early draft Preface excerpt: http://www.rmi.net/~lutz/lp4e-preface-preview.html For more details on both books, see O'Reilly's web pages: http://oreilly.com/catalog/9780596158064/ http://oreilly.com/catalog/9780596158088/ I also maintain pages about these books at: http://www.rmi.net/~lutz The new Learning Python is available today, in both paper and a variety of ebook and online forms; the Pocket Reference is printing and will be available shortly. Cheers, --Mark Lutz -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Hi, To create a .deb file you may use checkinstall, it's very simple and work very well. Em 25/09/2009, às 03:15, Olof Bjarnason escreveu: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On 2009-09-25, Piet van Oostrum p...@cs.uu.nl wrote: exar...@twistedmatrix.com (e) wrote: e I specifically left out all yield statements in my version, since that's e exactly the point here. :) With real coroutines, they're not necessary - e coroutine calls look just like any other call. With Python's enhanced e generators, they are. The first time I encountered coroutines was in Simula-67. Coroutine switching was certainly explicit there. IIRC, the keyword was resume. I'm not sure exactly what coroutine calls refers to, but the mis-feature in Python co-routines that's being discussed is the fact that you can only yeild/resume from the main coroutine function. You can't call a function that yields control back to the other coroutine(s). By jumping through some hoops you can get the same effect, but it's not very intuitive and it sort of feels wrong that the main routine has to know ahead of time when calling a function whether that function might need to yield or not. -- Grant Edwards grante Yow! Where does it go when at you flush? visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Pipelining tar create and tar extract the Python way...
On Wed, Sep 23, 2009 at 04:22:36PM -0700, Ray Van Dolson wrote: On Wed, Sep 23, 2009 at 03:52:11PM -0700, Ray Van Dolson wrote: Hi all; In the land'o'shell, I can do something like the following: tar cvf - SrcDir | (cd /dest ; tar xvf -) Bad form replying to my own post... while I'd still like to know if this is possible to do with the tarfile class, it seems like using subprocess.Popen() and calling tar from there with stdout set to PIPE is probably the way to go. I think this will result in the fastest way to copy files around. Sounds like shutil.copytree() may not be all that robust (and probably not very fast) in my version of Python (2.4.3 on RHEL5). Still open to creative suggestions... :) Never found a way to do this with the tarfile class directly, but used Popen() to call tar: # Time for some fancy shmancy calls to tar. First create the process that # will generate our tar file and set it to output to a PIPE. p1 = Popen([tar, cf, -, .], cwd=u['homedir'], stdout=PIPE) # Next, set up our consumer tar process. This one should extract its data # in the destination directory. p2 = Popen([tar, xf, -], cwd=new_homedir, stdin=p1.stdout) # Go! err = p2.communicate()[1] Nothing groundbreaking as this is from the examples in the documentation, but just in case anyone else stumbles across this.. Ray -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
2009/9/25 Daniel S. Braz dsb...@gmail.com: Hi, To create a .deb file you may use checkinstall, it's very simple and work very well. Hi Daniel, From what I gather browsing the web abount checkinstall, it seems to be built with make install in mind. Does it work with python setup.py install too? Em 25/09/2009, às 03:15, Olof Bjarnason escreveu: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- twitter.com/olofb olofb.wordpress.com olofb.wordpress.com/tag/english -- http://mail.python.org/mailman/listinfo/python-list
Re: Crypto and export laws
Piet van Oostrum wrote: M.-A. Lemburg m...@egenix.com (M-L) wrote: M-L Depending on how close a country follows the Wassenaar M-L Arrangement (http://www.wassenaar.org/) OpenSSL, Python M-L and all other open-source software falls under the M-L GENERAL SOFTWARE NOTE part 2.: M-L M-L The Lists do not control software which is either: M-L 1. ... M-L 2. In the public domain. M-L M-L If you're shipping a closed-source product that includes M-L OpenSSL, then you'd have to follow the rules in category 5 M-L part 2 of the dual-use list: M-L http://www.wassenaar.org/publicdocuments/index_CL.html But Python is not in the public domain. Open source != public domain. Public domain means there is no copyright and no license attached to it, AFAIK. As already mentioned in the thread, the in the public domain phrase in the WA list refers to anything that is available to anyone without restrictions to dissemination, e.g. open-source software, freeware, etc. For things you sell, the more restrictive cat. 5 part 2 note applies if you ship crypto code. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 25 2009) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ -- http://mail.python.org/mailman/listinfo/python-list
Re: importing with .m instead of .py
Wanderer Hi Refer to http://docs.python.org/tutorial/modules.html#the-module-search-path. Particularly- When a module named spam is imported, the interpreter searches for a file named spam.py in the current directory, and then in the list of directories specified by the environment variable PYTHONPATH. This has the same syntax as the shell variable PATH, that is, a list of directory names. When PYTHONPATH is not set, or when the file is not found there, the search continues in an installation-dependent default path; on Unix, this is usually .:/usr/local/lib/python. Having said that, please see below. I would like to import Matlab/Octave files of the .m sort into Python that look like this. # comment y=[1,2,3,4,5\ ,6,7,8,9]; # comment The only problem is I have to change the extensions from .m to .py. Is there a way to get python to import files that don't end in .py? You can try this for single file. Pretty trivial- $ cat foo.m y=[1,2,3] $ export PYTHONSTARTUP=foo.m $ python Python 2.6.1 (r261:826, Sep 17 2009, 01:16:52) [GCC 4.3.2] on linux2 [Unladen Swallow 2009Q3] Type help, copyright, credits or license for more information. dir() ['__builtins__', '__doc__', '__name__', '__package__', 'y'] y [1, 2, 3] Another way: f_ = open('foo.m','r'); j = f_.xreadlines() for i in j.xreadlines(): ... print i ... y=[1,2,3] Another way: import os; matlab_files=[]; for root, dirs, files in os.walk('.'): ... for i in files: ... if i.endswith(.m): ... matlab_files.append(i); ... matlab_files ['foo.m', 'bar.m'] for x in matlab_files: ... execfile(x); dir() ['__builtins__', '__doc__', '__name__', 'dirs', 'files', 'i', 'matlab_files', 'os', 'root', 'x', 'y', 'z'] x 'b.m' y [1, 2, 3] z [3, 2, 1] $ cat foo.m y=[1,2,3] $ cat bar.m z=[3,2,1] These sort of task are pretty trivial to do. You should take some time to read through the documentation.. and oh don't be such a wanderer loosing sight of such good resource such as http://docs.python.org :-) -- Regards, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing Python-programs to Ubuntu users
Yes, it work with any command that you can run on a shell. You could write a shell script to tell to checkinstall what to do with your program. I used to use it with java programs. I will send to your e-mail a simple sample script, so you will see how it's work. (sorry for my -- very -- bad english) Daniel Em 25/09/2009, às 12:54, Olof Bjarnason escreveu: 2009/9/25 Daniel S. Braz dsb...@gmail.com: Hi, To create a .deb file you may use checkinstall, it's very simple and work very well. Hi Daniel, From what I gather browsing the web abount checkinstall, it seems to be built with make install in mind. Does it work with python setup.py install too? Em 25/09/2009, às 03:15, Olof Bjarnason escreveu: Hi! I write small games in Python/PyGame. I want to find a way to make a downloadable package/installer/script to put on my webpage, especially for Ubuntu users. I've skimmed a couple of tutorials on how to generate .deb-files, but, wow, it's a whole new skill set to do that! Does anyone have any hint on a more economic way of creating single-file distribution packages for Python+PyGame projects? Maybe some GUI-tool that automates the .deb file creation process, but targetting Python specifically and not C++. /Olof -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- twitter.com/olofb olofb.wordpress.com olofb.wordpress.com/tag/english -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
ANN: agenda2pdf v1.0
Hi, I'm proud to present you agenda2pdf. This is a simple script which generates a book agenda file in PDF format, ready to be printed or loaded on an ebook reader. You can choose among different sections. Each section have pdf links to other parts of the agenda. I've created it for using with my iLiad eBook reader. Released under GNU Public License v3 or later. More info, documentation, screenshots, and download link in: https://inigo.katxi.org/devel/agenda2pdf or http://code.google.com/p/agenda2pdf. Of course, all comments, suggestions, etc. are welcome. Best regards, Iñigo Serna -- http://mail.python.org/mailman/listinfo/python-list
Re: New books: Learning Python, Python Pocket Reference 4th Eds
Thanks Mark. 2009/9/26 Mark Lutz l...@rmi.net: I'm happy to announce new, 4th editions of the O'Reilly books Learning Python and Python Pocket Reference. [] It was pleasant and such a fun going through LP(2nd ed for me). Python Cook book was a nice complement too. I miss those days when I hurriedly used to look up materials through it finding novel and cool ways of doing things (I still do find it very helpful) :-) Thanks for such a wonderful resource. -- Regards, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Fri, Sep 25, 2009 at 11:42 AM, Grant Edwards inva...@invalid.invalid wrote: On 2009-09-25, Piet van Oostrum p...@cs.uu.nl wrote: exar...@twistedmatrix.com (e) wrote: e I specifically left out all yield statements in my version, since that's e exactly the point here. :) With real coroutines, they're not necessary - e coroutine calls look just like any other call. With Python's enhanced e generators, they are. The first time I encountered coroutines was in Simula-67. Coroutine switching was certainly explicit there. IIRC, the keyword was resume. I'm not sure exactly what coroutine calls refers to, but the mis-feature in Python co-routines that's being discussed is the fact that you can only yeild/resume from the main coroutine function. You can't call a function that yields control back to the other coroutine(s). By jumping through some hoops you can get the same effect, but it's not very intuitive and it sort of feels wrong that the main routine has to know ahead of time when calling a function whether that function might need to yield or not. You mean a trampoline function? I.e. you have to call into your coroutines in a special main function that expects as part of the yielded value(s) the next coroutine to pass control to, and your coroutines all need to yield the next coroutine? ~Simon -- http://mail.python.org/mailman/listinfo/python-list
Re: Pipelining tar create and tar extract the Python way...
Ray. Hi tar cvf - SrcDir | (cd /dest ; tar xvf -) Check this out Ray if you haven't done it already http://docs.python.org/library/tarfile.html The tarfile module makes it possible to __read__ and write tar archives, including those using gzip or bz2 compression. Try breaking it up the functionality. That's how shell achieves this functionality as whole, why wouldn't you apply same technique in Python :-) Some modules that could help for your specific situations are tarfile and os. Popen is one way(It's what your spec says) but you'd want to do purely in Python. Aren't you curious? :-) It's late and TGIF! Need sleep. Goodluck. -- Regards, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list
Re: is this whiff/wsgi claim true?
regarding http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts Michele Simionato writes: To me, it looks like the approach Quixote used long before the coming of WSGI (see http://www.quixote.ca/learn/1 How Quixote Works). This a fair comparison and you could also note similarities with to modpy/publisher and even CGI but none of these are WSGI components or infrastructures whereas WHIFF is both a WSGI component and an infrastructure. So this is not the counterexample I was looking for. -- Aaron Watters === - She turned me into a newt! - A newt? - ...I got better. -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On 2009-09-25, Simon Forman sajmik...@gmail.com wrote: On Fri, Sep 25, 2009 at 11:42 AM, Grant Edwards inva...@invalid.invalid wrote: You can't call a function that yields control back to the other coroutine(s). ?By jumping through some hoops you can get the same effect, but it's not very intuitive and it sort of feels wrong that the main routine has to know ahead of time when calling a function whether that function might need to yield or not. You mean a trampoline function? I.e. you have to call into your coroutines in a special main function that expects as part of the yielded value(s) the next coroutine to pass control to, and your coroutines all need to yield the next coroutine? Exactly. Compared to real coroutines where a yield statement can occur anywhere, the trampoline business seems pretty convoluted. -- Grant Edwards grante Yow! Do you think the at Monkees should get gas on visi.comodd or even days? -- http://mail.python.org/mailman/listinfo/python-list
nested structure with internal references
Hi, sorry for posting in german before, that was a mistake. I'd like to use a nested structure in memory that consists of dict()s and list()s, list entries can be dict()s, other list()s, dict entries can be list()s or other dict()s. The lists and dicts can also contain int, float, string, ... But i'd also like to have something like a reference to another entry. I'd like to refer to another entry and not copy that entry, i need to know later that this is a reference to another entry, i need to find also access that entry then. Is something like this possible in Python? The references only need to refer to entries in this structure. The lists may change at runtime (entries removed / added), so storing the index may not help. Thanks for any hints, Torsten. -- http://mail.python.org/mailman/listinfo/python-list
Re: importing with .m instead of .py
On Sep 25, 12:15 pm, Ishwor Gurung ishwor.gur...@gmail.com wrote: Wanderer Hi Refer tohttp://docs.python.org/tutorial/modules.html#the-module-search-path. Particularly- When a module named spam is imported, the interpreter searches for a file named spam.py in the current directory, and then in the list of directories specified by the environment variable PYTHONPATH. This has the same syntax as the shell variable PATH, that is, a list of directory names. When PYTHONPATH is not set, or when the file is not found there, the search continues in an installation-dependent default path; on Unix, this is usually .:/usr/local/lib/python. Having said that, please see below. I would like to import Matlab/Octave files of the .m sort into Python that look like this. # comment y=[1,2,3,4,5\ ,6,7,8,9]; # comment The only problem is I have to change the extensions from .m to .py. Is there a way to get python to import files that don't end in .py? You can try this for single file. Pretty trivial- $ cat foo.m y=[1,2,3] $ export PYTHONSTARTUP=foo.m $ python Python 2.6.1 (r261:826, Sep 17 2009, 01:16:52) [GCC 4.3.2] on linux2 [Unladen Swallow 2009Q3] Type help, copyright, credits or license for more information. dir() ['__builtins__', '__doc__', '__name__', '__package__', 'y'] y [1, 2, 3] Another way: f_ = open('foo.m','r'); j = f_.xreadlines() for i in j.xreadlines(): ... print i ... y=[1,2,3] Another way: import os; matlab_files=[]; for root, dirs, files in os.walk('.'): ... for i in files: ... if i.endswith(.m): ... matlab_files.append(i); ... matlab_files ['foo.m', 'bar.m'] for x in matlab_files: ... execfile(x); dir() ['__builtins__', '__doc__', '__name__', 'dirs', 'files', 'i', 'matlab_files', 'os', 'root', 'x', 'y', 'z'] x 'b.m' y [1, 2, 3] z [3, 2, 1] $ cat foo.m y=[1,2,3] $ cat bar.m z=[3,2,1] These sort of task are pretty trivial to do. You should take some time to read through the documentation.. and oh don't be such a wanderer loosing sight of such good resource such ashttp://docs.python.org:-) -- Regards, Ishwor Gurung execfile(x) does what I'm looking for. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Poll: Do you use csv.Sniffer?
On Sep 24, 9:26 pm, s...@pobox.com wrote: If csv.Sniff was to be removed from a future version of Python, how difficult would it be to adapt? A good response would be... What are you adding to the stdlib that requires making space by removing csv.Sniff? Oh and, i never use the Sniffer ;-) -- http://mail.python.org/mailman/listinfo/python-list
problems compiling pyscopg2 on RHEL4
Hi All, I installed the following rpms: postgresql-libs-7.4.19-1.el4_6.1 postgresql-devel-7.4.19-1.el4_6.1 postgresql-7.4.19-1.el4_6.1 And then installed psycopg2 as follows: wget http://initd.org/pub/software/psycopg/psycopg2-2.0.12.tar.gz tar xzf psycopg2-2.0.12.tar.gz cd psycopg2-2.0.12 python2.6 setup.py install However, it appears something went wrong: # python2.6 Python 2.6.2 (r262:71600, Sep 25 2009, 12:03:16) [GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2 Type help, copyright, credits or license for more information. import psycopg2 Traceback (most recent call last): File stdin, line 1, in module File /usr/local/lib/python2.6/site-packages/psycopg2/__init__.py, line 60, in module from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: /usr/local/lib/python2.6/site-packages/psycopg2/_psycopg.so: undefined symbol: PQserverVersion Has anyone seen this and/or know how to fix it? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: nested structure with internal references
On Sep 25, 1:11 pm, Torsten Mohr tm...@s.netic.de wrote: Hi, sorry for posting in german before, that was a mistake. I'd like to use a nested structure in memory that consists of dict()s and list()s, list entries can be dict()s, other list()s, dict entries can be list()s or other dict()s. The lists and dicts can also contain int, float, string, ... But i'd also like to have something like a reference to another entry. I'd like to refer to another entry and not copy that entry, i need to know later that this is a reference to another entry, i need to find also access that entry then. Is something like this possible in Python? The references only need to refer to entries in this structure. The lists may change at runtime (entries removed / added), so storing the index may not help. Thanks for any hints, Torsten. hello, maybe i know less python than you do, but i am talking from the point of view of my common sense and experience. if you store an object in a list more than once, i doubt that python creates a duplicate. unless the object is a value type. thus you have a reference to this object in both elements. and then if you are asking this question, maybe your design is not good enough? would you explain the problem? konstantin -- http://mail.python.org/mailman/listinfo/python-list
Re: importing with .m instead of .py
On Sep 25, 1:16 pm, Wanderer wande...@dialup4less.com wrote: execfile(x) does what I'm looking for. Perhaps you are looking for Python import hook: http://www.python.org/dev/peps/pep-0302/ In you import hook you can do everything (and locate/import file with any extension :) -- http://mail.python.org/mailman/listinfo/python-list
Got undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString on OpenSuSE 11.1
Hello I sent this e-mail to the python-help list but I'm not sure if that list is active... so I post it again here: I'm trying to build Python 2.6.2 from the sources downloaded from the python official site on OpenSuSE 11.1 (32 bit). After installation the python command line interpreter seems to run ok, but when I try to install setuptools I get: u...@linux-ba2a:~/tmp bash setuptools-0.6c9-py2.6.egg --install-dir=/home/user/python/lib/python2.6/site-packages/ Traceback (most recent call last): File string, line 1, in module File /home/user/tmp/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py, line 15, in module File /home/user/tmp/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py, line 1, in module ImportError: /home/user/python/lib/python2.6/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString To compile Python I executed: ./configure --prefix=/home/user/python ./make ./make install The compile process seems to be ok, so I'm kind of clueless :-( Any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Fri, 2009-09-25 at 15:42 +, Grant Edwards wrote: You can't call a function that yields control back to the other coroutine(s). By jumping through some hoops you can get the same effect, but it's not very intuitive and it sort of feels wrong that the main routine has to know ahead of time when calling a function whether that function might need to yield or not. Not directly, but you can simulate this, or at least some pseudo form of it which is useful in practice. I suppose you could call this jumping through some hoops, but from the point of view of the coroutine, it can be done completely transparently, managed by the coroutine scheduler. In kaa, which I mentioned earlier, this might look like: import kaa @kaa.coroutine() def task(name): for i in range(10): print name, i yield kaa.NotFinished # kind of like a time slice @kaa.coroutine() def fetch_google(): s = kaa.Socket() try: yield s.connect('google.com:80') except: print 'Connection failed' return yield s.write('GET / HTTP/1.1\nHost: google.com\n\n') yield (yield s.read()) @kaa.coroutine() def orchestrate(): task('apple') task('banana') page = yield fetch_google() print 'Fetched %d bytes' % len(page) orchestrate() kaa.main.run() The two task() coroutines spawned by orchestrate() continue to run in the background while any of the yields in fetch_google() are pending (waiting on some network resource). It's true that the yields in fetch_google() aren't yielding control _directly_ to one of the task() coroutines, but it _is_ doing so indirectly, via the coroutine scheduler, which runs inside the main loop. Cheers, Jason. -- http://mail.python.org/mailman/listinfo/python-list
Re: nested structure with internal references
On Sep 25, 10:11 am, Torsten Mohr tm...@s.netic.de wrote: Hi, sorry for posting in german before, that was a mistake. I'd like to use a nested structure in memory that consists of dict()s and list()s, list entries can be dict()s, other list()s, dict entries can be list()s or other dict()s. The lists and dicts can also contain int, float, string, ... But i'd also like to have something like a reference to another entry. I'd like to refer to another entry and not copy that entry, i need to know later that this is a reference to another entry, i need to find also access that entry then. Is something like this possible in Python? The references only need to refer to entries in this structure. The lists may change at runtime (entries removed / added), so storing the index may not help. Hmm, I think I understand what you're asking but I don't think there's an easy way. Probably the most straightforward way is to use cells of some sort to contain the entries in a list or dict; then take references to the cells. That way you can change the cell's value while still maintaining the reference. For instance, suppose you have a list like this: lst = [ 1, 2, 3, 4 ] Convert it to this: lst = [ [1], [2], [3], [4] ] where you are using a nested singleton list as the cell type. Then, you can take a reference like this: ref = lst[2] If you insert an item into the list, the reference remains valid: lst.insert(0,[0]) And, if you change the value of the cell, the reference will see the updated value. lst[3][0] = 5 The downside is that you have to add [0] everywhere. The reference's value is ref[0], not just ref. The third item in the list is lst[2] [0], not just lst[2]. You could define custom list- and dict-like classes that automatically do this, mitigating the problem somewhat. I hope you could understand that suggestion, it's tough to describe. Other than that, you are stuck with massive use of Observer pattern (you'd have to create list- and dict-like types that know when something is referencing them, and that notify the references whenever they change). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On 2009-09-25, Jason Tackaberry t...@urandom.ca wrote: On Fri, 2009-09-25 at 15:42 +, Grant Edwards wrote: You can't call a function that yields control back to the other coroutine(s). By jumping through some hoops you can get the same effect, but it's not very intuitive and it sort of feels wrong that the main routine has to know ahead of time when calling a function whether that function might need to yield or not. Not directly, but you can simulate this, or at least some pseudo form of it which is useful in practice. I suppose you could call this jumping through some hoops, It's nice that I could, because I did. :) but from the point of view of the coroutine, it can be done completely transparently, managed by the coroutine scheduler. In kaa, which I mentioned earlier, this might look like: import kaa @kaa.coroutine() def task(name): for i in range(10): print name, i yield kaa.NotFinished # kind of like a time slice @kaa.coroutine() def fetch_google(): s = kaa.Socket() try: yield s.connect('google.com:80') That's not comletely transparently. The routine fetch_google() has to know a priori that s.connect() might want to yield and so has to invoke it with a yield statement. Completely transparent would be this: try: s.connect('google.com:80') except: print 'Connection faild' return yield s.write('GET / HTTP/1.1\nHost: google.com\n\n') yield (yield s.read()) Again, you have to know ahead of time which functions might yeild and which ones don't and call them differently. That's the hoop. If somewhere in the implementation of a function you dicover a need to yield, you have to modify all the calls all the way up to the top frame. It's true that the yields in fetch_google() aren't yielding control _directly_ to one of the task() coroutines, but it _is_ doing so indirectly, via the coroutine scheduler, which runs inside the main loop. True. But I wouldn't call that transparent. -- Grant Edwards grante Yow! Can I have an IMPULSE at ITEM instead? visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: nested structure with internal references
put a (name, value) pair in each list element instead of just value and reference them by name, you can use uuid to generate names konstantin -- http://mail.python.org/mailman/listinfo/python-list
Re: Got undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString on OpenSuSE 11.1
On Sep 25, 7:05 pm, Alejandro Valdez alejandro.val...@gmail.com wrote: Hello I sent this e-mail to the python-help list but I'm not sure if that list is active... so I post it again here: I'm trying to build Python 2.6.2 from the sources downloaded from the python official site on OpenSuSE 11.1 (32 bit). After installation the python command line interpreter seems to run ok, but when I try to install setuptools I get: [...] To compile Python I executed: ./configure --prefix=/home/user/python ./make ./make install The compile process seems to be ok, so I'm kind of clueless :-( Any ideas? This is just a guess, but try configuring with: ./configure --enable-unicode=ucs4 --prefix=/home/user/python On Linux, by default, a self-compiled Python uses UCS2 internally for its unicode support (with some support for UTF16). Most Linux distributions, however, distribute a Python that uses UCS4 (aka UTF32) instead, so it seems possible that your setuptools egg is expecting to find a UCS4 build. Mark -- http://mail.python.org/mailman/listinfo/python-list
flow control and nested loops
In Perl, one can label loops for finer flow control. For example: X: for my $x (@X) { Y: for my $y (@Y) { for my $z (@Z) { next X if test1($x, $y, $z); next Y if test2($x, $y, $z); frobnicate($x, $y, $z); } glortz($x, $y); } splat($x); } What's considered best practice in the Python world for this sort of situation? The only approach I can think of requires setting up indicator variables that must be set and tested individually; e.g. for x in X: next_X = False for y in Y: next_Y = False for z in Z: if test1(x, y, z): next_X = True break if test2(x, y, z): next_Y = True break frobnicate(x, y, z) if next_X: break if next_Y: continue glortz(x, y) if next_X: continue splat(x) Whereas I find the Perl version reasonably readable, the Python one I find nearly incomprehensible. In fact, I'm not even sure that the Python version faithfully replicates what the Perl one is doing! Is there a better approach? TIA! kynn -- http://mail.python.org/mailman/listinfo/python-list
Re: nested structure with internal references
On Sep 25, 9:11 pm, Torsten Mohr tm...@s.netic.de wrote: I'd like to refer to another entry and not copy that entry, i need to know later that this is a reference to another entry, i need to find also access that entry then. The references only need to refer to entries in this structure. The lists may change at runtime (entries removed / added), so storing the index may not help. Python already stores everything as a reference, no need to invent your own. Consider this example: data = This is real data container = [ data, [ data ]] container ['This is real data', ['This is real data']] 'container' contains a reference to the data, and another list, with another reference. You can easily check this by using a built-in function id() which returns an object's identity: id(container[0]) 140191569359088 id(container[1][0]) 140191569359088 id(data) 140191569359088 So all python lists and dicts hold are references, and the real data is elsewhere. Do you really need to have real reference to your data in one place, or you are trying to avoid infinite loops in your data (python handles this as well)? -- http://mail.python.org/mailman/listinfo/python-list
What does the list_folders() method of mailbox.Maildir actually do (if anything)?
I can't get the list_folders() method of the mailbox.Maildir class to do anything remotely useful. It seems to do nothing at all. I have a directory which contains a number of maildir malboxes:- chris$ ls -l /home/chris/Mail/apex total 24 drwx-- 5 chris chris 4096 2009-04-30 09:45 charles.rustin drwx-- 5 chris chris 4096 2009-04-30 09:45 greg drwx-- 5 chris chris 4096 2009-04-30 09:45 maureenMcgoldrick drwx-- 5 chris chris 4096 2009-04-30 09:45 ram drwx-- 5 chris chris 4096 2009-04-30 09:46 sarahLagley drwx-- 5 chris chris 4096 2009-04-30 09:46 symonSmith chris$ ls -l /home/chris/Mail/apex/ram total 12 drwx-- 2 chris chris 4096 2009-04-30 09:45 cur drwx-- 2 chris chris 4096 2009-04-30 09:45 new drwx-- 2 chris chris 4096 2009-04-30 09:45 tmp If I run the following code:- #!/usr/bin/python # # # Mail archiving utility # import mailbox topLevel=mailbox.Maildir(/home/chris/Mail/apex) print topLevel.list_folders() It just outputs []. Am I doing something totally wrong or is list_folders() completely broken? -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Fri, Sep 25, 2009 at 2:07 PM, Jason Tackaberry t...@urandom.ca wrote: On Fri, 2009-09-25 at 15:42 +, Grant Edwards wrote: You can't call a function that yields control back to the other coroutine(s). By jumping through some hoops you can get the same effect, but it's not very intuitive and it sort of feels wrong that the main routine has to know ahead of time when calling a function whether that function might need to yield or not. Not directly, but you can simulate this, or at least some pseudo form of it which is useful in practice. I suppose you could call this jumping through some hoops, but from the point of view of the coroutine, it can be done completely transparently, managed by the coroutine scheduler. In kaa, which I mentioned earlier, this might look like: import kaa �...@kaa.coroutine() def task(name): for i in range(10): print name, i yield kaa.NotFinished # kind of like a time slice �...@kaa.coroutine() def fetch_google(): s = kaa.Socket() try: yield s.connect('google.com:80') except: print 'Connection failed' return yield s.write('GET / HTTP/1.1\nHost: google.com\n\n') yield (yield s.read()) �...@kaa.coroutine() def orchestrate(): task('apple') task('banana') page = yield fetch_google() print 'Fetched %d bytes' % len(page) orchestrate() kaa.main.run() The two task() coroutines spawned by orchestrate() continue to run in the background while any of the yields in fetch_google() are pending (waiting on some network resource). It's true that the yields in fetch_google() aren't yielding control _directly_ to one of the task() coroutines, but it _is_ doing so indirectly, via the coroutine scheduler, which runs inside the main loop. Cheers, Jason. So Kaa is essentially implementing the trampoline function. If I understand it correctly MyHDL does something similar (to implement models of hardware components running concurrently.) http://www.myhdl.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Fri, 2009-09-25 at 18:36 +, Grant Edwards wrote: That's not comletely transparently. The routine fetch_google() has to know a priori that s.connect() might want to yield and so has to invoke it with a yield statement. With my implementation, tasks that execute asynchronously (which may be either threads or coroutines) return a special object called an InProgress object. You always yield such calls. So you're right, it does require knowing a priori what invocations may return InProgress objects. But this isn't any extra effort. It's difficult to write any non-trivial program without knowing a priori what callables will return, isn't it? Completely transparent would be this: [...] try: s.connect('google.com:80') except: Jean-Paul made the same argument. In my view, the requirement to yield s.connect() is a feature, not a bug. Here, IMO explicit truly is better than implicit. I prefer to know at what specific points my routines may branch off. And I maintain that requiring yield doesn't make it any less a coroutine. Maybe we can call this an aesthetic difference of opinion? Again, you have to know ahead of time which functions might yeild and which ones don't and call them differently. That's the hoop. To the extent it should be considered jumping through hoops to find what any callable returns, all right. It's true that the yields in fetch_google() aren't yielding control _directly_ to one of the task() coroutines, but it _is_ doing so indirectly, via the coroutine scheduler, which runs inside the main loop. True. But I wouldn't call that transparent. What I meant by transparent is the fact that yield inside fetch_google() can yield to (indirectly) any active coroutine. It doesn't (and can't) know which. I was responding to your specific claim that: [...] the mis-feature in Python co-routines that's being discussed is the fact that you can only yeild/resume from the main coroutine function. With my implementation this is only half true. It's true that for other active coroutines to be reentered, main coroutines (there can be more than one in kaa) will need to yield, but once control is passed back to the coroutine scheduler (which is hooked into main loop facility), any active coroutine may be reentered. Cheers, Jason. -- http://mail.python.org/mailman/listinfo/python-list
Re: Most active coroutine library project?
On Fri, 2009-09-25 at 15:25 -0400, Simon Forman wrote: So Kaa is essentially implementing the trampoline function. Essentially, yeah. It doesn't require (or support, depending on your perspective) a coroutine to explicitly yield the next coroutine to be reentered, but otherwise I'd say it's the same basic construct. Cheers, Jason. -- http://mail.python.org/mailman/listinfo/python-list
Re: What does the list_folders() method of mailbox.Maildir actually do (if anything)?
On Sep 25, 3:22 pm, tinn...@isbd.co.uk wrote: I can't get the list_folders() method of the mailbox.Maildir class to do anything remotely useful. It seems to do nothing at all. I have a directory which contains a number of maildir malboxes:- chris$ ls -l /home/chris/Mail/apex total 24 drwx-- 5 chris chris 4096 2009-04-30 09:45 charles.rustin drwx-- 5 chris chris 4096 2009-04-30 09:45 greg drwx-- 5 chris chris 4096 2009-04-30 09:45 maureenMcgoldrick drwx-- 5 chris chris 4096 2009-04-30 09:45 ram drwx-- 5 chris chris 4096 2009-04-30 09:46 sarahLagley drwx-- 5 chris chris 4096 2009-04-30 09:46 symonSmith chris$ ls -l /home/chris/Mail/apex/ram total 12 drwx-- 2 chris chris 4096 2009-04-30 09:45 cur drwx-- 2 chris chris 4096 2009-04-30 09:45 new drwx-- 2 chris chris 4096 2009-04-30 09:45 tmp If I run the following code:- #!/usr/bin/python # # # Mail archiving utility # import mailbox topLevel=mailbox.Maildir(/home/chris/Mail/apex) print topLevel.list_folders() It just outputs []. Am I doing something totally wrong or is list_folders() completely broken? -- Chris Green The Maildir++ spec states that folders need to begin with a period. The list_folders method enforces that: def list_folders(self): Return a list of folder names. result = [] for entry in os.listdir(self._path): if len(entry) 1 and entry[0] == '.' and \ os.path.isdir(os.path.join(self._path, entry)): result.append(entry[1:]) return result The above example is from 2.6. Your structure is simply a list of Maildir compliant directories below '/home/chris/Mail/apex.' They're not, in the Maildir++ sense of the word, folders. -- Thanks, Jeff mcjeff.blospot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: importing with .m instead of .py
On Sep 25, 2:05 pm, Andrew Svetlov andrew.svet...@gmail.com wrote: On Sep 25, 1:16 pm, Wanderer wande...@dialup4less.com wrote: execfile(x) does what I'm looking for. Perhaps you are looking for Python import hook:http://www.python.org/dev/peps/pep-0302/ In you import hook you can do everything (and locate/import file with any extension :) I'm just porting a bunch of octave functions into pylab that use data I collected in files like I show above. The execfile() method lets me verify I get the same results in Octave and Python. It is in the NumPy for Matlab users page at Mathesaurus http://mathesaurus.sourceforge.net/matlab-numpy.html, but they make it look like it needs a .py extension. Like Ishwor said 'Trivial', now that I know how :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Got undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString on OpenSuSE 11.1
On Sep 25, 7:56 pm, Mark Dickinson dicki...@gmail.com wrote: On Sep 25, 7:05 pm, Alejandro Valdez alejandro.val...@gmail.com wrote: Hello I sent this e-mail to the python-help list but I'm not sure if that list is active... so I post it again here: I'm trying to build Python 2.6.2 from the sources downloaded from the python official site on OpenSuSE 11.1 (32 bit). After installation the python command line interpreter seems to run ok, but when I try to install setuptools I get: [...] To compile Python I executed: ./configure --prefix=/home/user/python ./make ./make install The compile process seems to be ok, so I'm kind of clueless :-( Any ideas? This is just a guess, but try configuring with: ./configure --enable-unicode=ucs4 --prefix=/home/user/python On Linux, by default, a self-compiled Python uses UCS2 internally for its unicode support (with some support for UTF16). Most Linux distributions, however, distribute a Python that uses UCS4 (aka UTF32) instead, so it seems possible that your setuptools egg is expecting to find a UCS4 build. Also, make sure that setuptools is picking up the right python2.6 executable: you want it to be using the one in /home/user/python/bin, not the one in /usr/bin (or where-ever SuSE keeps its python). What does 'which python2.6' give on your system, after the python install but before the setuptools install? It may be necessary to set the PYTHONPATH environment variable too; I'm not sure about this. I admit I don't really understand how you could be getting an undefined _PyUnicodeUCS2* symbol; undefined _PyUnicodeUCS4* would make more sense. Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: flow control and nested loops
On Fri, Sep 25, 2009 at 3:01 PM, kj no.em...@please.post wrote: In Perl, one can label loops for finer flow control. For example: X: for my $x (@X) { Y: for my $y (@Y) { for my $z (@Z) { next X if test1($x, $y, $z); next Y if test2($x, $y, $z); frobnicate($x, $y, $z); } glortz($x, $y); } splat($x); } What's considered best practice in the Python world for this sort of situation? The only approach I can think of requires setting up indicator variables that must be set and tested individually; e.g. for x in X: next_X = False for y in Y: next_Y = False for z in Z: if test1(x, y, z): next_X = True break if test2(x, y, z): next_Y = True break frobnicate(x, y, z) if next_X: break if next_Y: continue glortz(x, y) if next_X: continue splat(x) Whereas I find the Perl version reasonably readable, the Python one I find nearly incomprehensible. In fact, I'm not even sure that the Python version faithfully replicates what the Perl one is doing! Is there a better approach? TIA! kynn snarkThe best approach would be to reorganize your code so you didn't have to do that./snark Seriously though, I find both the perl and python versions non-obvious. You have had to use constructs like this in practice? Generally, I would use flags in tricky nested loops just like you did, perhaps with some comments to clarify things. An alternative might be to use custom exceptions. Hopefully someone smarter than me will come along and show an even better approach. class NextX(Exception): pass class NextY(Exception): pass for x in X: try: for y in Y: try: for z in Z: if test1(x, y, z): raise NextX if test2(x, y, z): raise NextY frobnicate(x, y, z) except NextY: continue glortz(x, y) except NextX: continue splat(x) -- http://mail.python.org/mailman/listinfo/python-list
Re: flow control and nested loops
kj wrote: In Perl, one can label loops for finer flow control. For example: X: for my $x (@X) { Y: for my $y (@Y) { for my $z (@Z) { next X if test1($x, $y, $z); next Y if test2($x, $y, $z); frobnicate($x, $y, $z); } glortz($x, $y); } splat($x); } What's considered best practice in the Python world for this sort of situation? The only approach I can think of requires setting up indicator variables that must be set and tested individually; e.g. for x in X: next_X = False for y in Y: next_Y = False for z in Z: if test1(x, y, z): next_X = True break if test2(x, y, z): next_Y = True break frobnicate(x, y, z) if next_X: break if next_Y: continue glortz(x, y) if next_X: continue splat(x) Whereas I find the Perl version reasonably readable, the Python one I find nearly incomprehensible. In fact, I'm not even sure that the Python version faithfully replicates what the Perl one is doing! Is there a better approach? 1. Put inner loops in a function and return instead of break. 2. Put inner loops in try: for.. for if cond: raise Something # or do operation that raises exception if cond is true except e: whatever tjr -- http://mail.python.org/mailman/listinfo/python-list