[pygtk] ANNOUNCE: PyGTK 2.10.0
I am pleased to announce version 2.10.0 of the Python bindings for GTK. The new release is available from ftp.gnome.org and its mirrors as soon as its synced correctly: http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.10/ This is an unstable release and should be used with caution. Blurb: GTK is a toolkit for developing graphical applications that run on systems such as Linux, Windows and MacOS X. It provides a comprehensive set of GUI widgets, can display Unicode bidi text. It links into the Gnome Accessibility Framework through the ATK library. PyGTK provides a convenient wrapper for the GTK+ library for use in Python programs, and takes care of many of the boring details such as managing memory and type casting. When combined with PyORBit and gnome-python, it can be used to write full featured Gnome applications. Like the GTK+ library itself PyGTK is licensed under the GNU LGPL, so is suitable for use in both free software and proprietary applications. It is already in use in many applications ranging from small single purpose scripts up to large full features applications. What's new since 2.9.6? - Issue a warning when a DISPLAY is not set (#316877, Johan, Jeremey Katz) - Copy style.css from pygobject docs when installing docs. (#351385 Gian Mario Tagliaretti) - Include the built docs in the tarball (Johan) PyGTK requires GTK+ = 2.8.0 and Python = 2.3.5 to build. GTK+ 2.10.0 is required for 2.10 API. Bug reports, as always, should go to Bugzilla; check out http://pygtk.org/developer.html and http://pygtk.org/feedback.html for links to posting and querying bug reports for PyGTK. What's new in 2.10.0? * Includes John Finlays reference manual * gobject bindings were removed, moved to a separate tarball * Added GTK+ 2.10 API: Assistant, CellRendererSpin, LinkButton, Printing*, RecentChooser, StatusIcon * Many code generator improvements * New module gtk.unixprint * Reduced memory usage * MacOS X support * Many bug fixes See NEWS for a complete list of changes Acknowledgements: Thanks to everybody who helped making this release possible: Wander Boessenkool, Wouter Bolsterlee, Ross Burton,Marco Cabizza Ben Caradoc-Davies, Gustavo J. A. M. Carneiro, Ed Catmur, Steve Chaplin Murray Cumming, Johan Dahlin, John Ehresman, Rafael Ávila de Espíndola, John Finlay, Cedric Gustin, Richard Hult, Jeremey Katz, Steven Kennedy Nikos Kouremenos, Alexander Larsson, Baiju M, Stefano Maggiolo, Mark McLoughlin, Hamish Moffatt, Yevgen Muntyan, Elijah Newren Patrick O'Brien, Frederic Peters, Sebastian Pölsterl, Sebastian Rittau Rauli Ruohonen, Joseph Sacco, Johan Svedberg, Gian Mario Tagliaretti Dieter Verfaillie, Karel Vervaeke, Olav Vitters and Andy Wingo -- Johan Dahlin [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
ANNOUNCE: PyGObject 2.12.0
I am pleased to announce version 2.12.0 of the Python bindings for GObject. The new release is available from ftp.gnome.org as and its mirrors as soon as its synced correctly: http://download.gnome.org/sources/pygobject/2.12/ What's new since PyGObject 2.11.3: - Install the html files even when using --disable-docs (#353159, Johan, Matthias Clasen) Blurb: GObject is a object system library used by GTK+ and GStreamer. PyGObject provides a convenient wrapper for the GObject+ library for use in Python programs, and takes care of many of the boring details such as managing memory and type casting. When combined with PyGTK, PyORBit and gnome-python, it can be used to write full featured Gnome applications. Like the GObject library itself PyGObject is licensed under the GNU LGPL, so is suitable for use in both free software and proprietary applications. It is already in use in many applications ranging from small single purpose scripts up to large full featured applications. PyGObject requires GObject = 2.8.0 and Python = 2.3.5 to build. What's new in 2.12.0? * John Finlays reference manual is now included and prebuilt * GOption is now supported * Support for signal emission hooks * Various GInterface related improvements * Many bug fixes Acknowledgements: Thanks to everybody who helped making this release possible: Gustavo J. A. M. Carneiro Matthias Clasen Murray Cumming John Ehresman John Finlay Cedric Gustin Johannes Hölzl Kjartan Maraas Yevgen Muntyan Gian Mario Tagliaretti Andy Wingo -- Johan Dahlin [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Reminder: Michigan Python Users Group meeting on Thursday
This is a reminder of the upcoming michipug meeting. This is the first anniversary meeting of the Michigan Python Users Group! Thursday, September 7th at 7PM Our topics for this month include an SQLAlchemy Introduction by Mark Ramm and Steve Kryskalla talking about two of the new Python 2.5 features. The meeting will be held at the Arbor Networks office in Ann Arbor.: Arbor Networks City Center Building 220 East Huron, 6th Floor Ann Arbor, MI Map: http://tinyurl.com/pt957 With the topics we have for this meeting, I would expect about 90 minutes of the main topics. We often have free-flowing discussion following the main topics, so feel free to come with other topics you wish to discuss. See you there! Kevin -- Kevin Dangoor TurboGears / Zesty News email: [EMAIL PROTECTED] company: http://www.BlazingThings.com blog: http://www.BlueSkyOnMars.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
itools 0.14.2 released
itools is a Python library, it groups a number of packages into a single meta-package for easier development and deployment: itools.catalogitools.http itools.uri itools.cmsitools.i18n itools.vfs itools.csvitools.ical itools.web itools.datatypes itools.rss itools.workflow itools.gettextitools.schemas itools.xhtml itools.handlers itools.stl itools.xliff itools.html itools.tmx itools.xml This release brings user interface improvements and many bug fixes. These are the most important changes: itools.catalog -- Fix keyword fields that are indexed but not stored, when there is at least one value that contains spaces. The format of the catalog changes a little so it must be rebuilt. itools.cms -- The HTML/CSS code for the tabs has been updated to work better in different browsers, now it even looks nice in text mode (#382). The web interface for calendar objects has seen various improvements (#82, #496). The configuration file and the icms-init script accept a new option, smtp-host, which defines the host to use to send emails. A bunch of minor bugs have been fixed in itools.cms, including #306, #308, #458, #459, #460, #497, #498, #500 and #501. itools.csv -- The CSV parser has been separated from the CSV handler, so it can be used independently (from itools.csv import parser). Fixed a serious bug which prevented to create CSV handlers from scratch. itools.gettext -- Now the PO handler properly detects the charset defined in the PO files header. The family of igettext scripts has been updated to use the new API of itools 0.14. itools.xhtml -- Now the title attribute of (X)HTML documents is always extracted to be translated, not only in img elements. Fix corner case in the automatic translation code. Declare some elements as inline to improve the behaviour of the translation machinery. Credits: - Hervé Cauwelier improved the web interface of itools.cms; - Nicolas Deram updated the calendar code; - J. David Ibáñez fixed many bugs; - Josef Meile found the problem in the PO handler. Resources - Download http://download.ikaaro.org/itools/itools-0.14.2.tar.gz Home http://www.ikaaro.org/itools Mailing list http://mail.ikaaro.org/mailman/listinfo/itools Bug Tracker http://bugs.ikaaro.org/ -- J. David Ibáñez Itaapy http://www.itaapy.com Tel +33 (0)1 42 23 67 45 9 rue Darwin, 75018 Paris Fax +33 (0)1 53 28 27 88 -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
pyPgSQL / trac issues
Hey guys, Has anyone seen this error when installing trac? The problem seems related to pyPgSQL, which is installed. (Although I had to go in and add some headers to make it work) Templates directory [/usr/local/share/trac/templates] Creating and Initializing Project Failed to create environment. /usr/local/lib/python2.4/site-packages/pyPgSQL/libpq/libpqmodule.so: undefined symbol: lo_export Traceback (most recent call last): File /usr/local/lib/python2.4/site-packages/trac/scripts/admin.py, line 139, in env_create self.__env = Environment(self.envname, create=True, db_str=db_str) File /usr/local/lib/python2.4/site-packages/trac/env.py, line 79, in __init__ self.create(db_str) File /usr/local/lib/python2.4/site-packages/trac/env.py, line 197, in create db.init_db(self.path, db_str) File /usr/local/lib/python2.4/site-packages/trac/db.py, line 442, in init_db cls.init_db(**args) File /usr/local/lib/python2.4/site-packages/trac/db.py, line 408, in init_db self = cls(**args) File /usr/local/lib/python2.4/site-packages/trac/db.py, line 376, in __init__ from pyPgSQL import PgSQL File /usr/local/lib/python2.4/site-packages/pyPgSQL/PgSQL.py, line 449, in ? from libpq import * File /usr/local/lib/python2.4/site-packages/pyPgSQL/libpq/__init__.py, line 23, in ? from libpq import * ImportError: /usr/local/lib/python2.4/site-packages/pyPgSQL/libpq/libpqmodule.so: undefined symbol: lo_export Failed to initialize environment. 1 Traceback (most recent call last): File /usr/local/lib/python2.4/site-packages/trac/scripts/admin.py, line 594, in do_initenv self.env_create(db_str) File /usr/local/lib/python2.4/site-packages/trac/scripts/admin.py, line 144, in env_create sys.exit(1) SystemExit: 1 -- http://mail.python.org/mailman/listinfo/python-list
Re: What are super()'s semantics?
Michele Simionato [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Anyway, the MRO concept is documented here: http://www.python.org/download/releases/2.3/mro/ A very edifying document. Indeed, in Nutshell Alex M. mentions your paper at the end of his high-level explanation of the MRO. In my infinite wisdom, I had chosen not to follow up by reading about the nitty-gritty details :-) As I mentioned in another post, it wasn't my lack of understanding of the MRO per se that tripped me up. I somehow managed to know that in Alex's example, an instance of the D class would have an MRO of essentially (D, C, B, A), and yet not realize that this was strangly similar to the output of the example. D'oh! Thanks, Mike -- http://mail.python.org/mailman/listinfo/python-list
Re: What are super()'s semantics?
Maric Michaud wrote: Le lundi 04 septembre 2006 22:29, Carl Banks a écrit : BTW, __class__ is available to instances. (Were you thinking of __bases__?) hmmm, I guess they're not the same, are they ? but you're right, __bases__ and some others are class attributes not available in instances, I wonder where is this documented and I'm not enough familiar with python' source code to find this. Also this create weird things, like a code posted on this list, which was very confusing and looked to something like : In [24]: class A(object) : : __class__ = list : : In [25]: A.__class__ Out[25]: type 'type' In [26]: A().__class__ Out[26]: type 'list' In [27]: isinstance(A(), list) # ouch ! Out[27]: True In [29]: type(A()) Out[29]: class '__main__.A' In [30]: type(A()).mro() Out[30]: [class '__main__.A', type 'object'] You are beginning to appreciate the meaning of the phrase Python is a language for use by consenting adults. The general philosophy is to provide a coherent and easily-used framework in the expectation that users will not shoot themselves in the foot (too often). regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Sandra-24 wrote: [Sandra understands shared memory] I would find an easier time, I think, porting mod_python to .net and leaving that GIL behind forever. Thankfully, I'm not considering such drastic measures - yet. Quite right too. You haven't even sacrificed a chicken yet ... Why on earth would I want to do all of that work? Just because you want to keep this evil thing called a GIL? My suggestion is in python 3 ditch the ref counting, use a real garbage collector, and make that GIL walk the plank. I have my doubts that it would happen, but that's fine, the future of python is in things like IronPython and PyPy. CPython's days are numbered. If there was a mod_dotnet I wouldn't be using CPython anymore. You write as though the GIL was invented to get in the programmer's way, which is quite wrong. It's there to avoid deep problems with thread interaction. Languages that haven't bitten that bullet can bite you in quite nasty ways when you write threaded applications. Contrary to your apparent opinion, the GIL has nothing to do with reference-counting. Now, the GIL is independent of this; if you really need threading in your situation (you share almost everything and have hugely complex data structures that are difficult to maintain in shm) then you're still going to run into GIL serialization. If you're doing a lot of work in native code extensions this may not actually be a big performance hit, if not it can be pretty bad. Actually, I'm not sure I understand you correctly. You're saying that in an environment like apache (with 250 threads or so) and my hugely complex shared data structures, that the GIL is going to cause a huge performance hit? So even if I do manage to find my way around in the Linux world, and I upgrade my memory, I'm still going to be paying for that darned GIL? I think the suggestion was rather that abandoning Python because of the GIL might be premature optimisation. But since you appear to be sticking with it, that might have been unnecessary advice. Will the madness never end? This reveals an opinion of the development team that's altogether too low. I believe the GIL was introduced for good reasons. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it just me, or is Sqlite3 goofy?
[EMAIL PROTECTED] wrote: Probably just me. I've only been using Access and SQL Server for 12 years, so I'm sure my opinions don't count for anything. [...] Ok, next issue, what the fuck are [varchar] and [decimal]? [..] It's still fuckin' goofy. Language ... regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: newbie pipe question
[EMAIL PROTECTED] wrote: Hi I want to write a python script that accepts input ( a single line of text) from another program (squid proxy) and sends back output ( a single line of text). I am not sure how to go about this Traditionally one of the popenN() functions would have been the way to do this. Nowadays one might prefer the subprocess module's facilities. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
=?iso-8859-1?q?How_to_allow_special_character's_like_=EF, =F9, acute_e_etc...?=
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file, 2. Text checks for max. length of the field whether the field is mandatory or optional Example: Text('Description', 100, optional=True) Parameters: Name of the field = 'Description' Max length = 100 Optional = 'True' (the field is not mandaory) 3. valid-text expressions, Example: ValidText('Minor', '[yYnN]') Parameters: name= field name regex = the regular expression y/Y for Yes n/N for No Recently we are getting data, where, the name contains non-english characters like: ' ATHUMANIù ', ' LUCIANA S. SENGïONGO '...etc Using the Text function, these names are not validated as they contain special characters or non-english characters (ï,ù). But the data is correct. Is there any function that can allow such special character's but not numbers...? Secondly, If I were to get the data in Russian text, are there any (lingual) packages available so that i can use the the same module for validation. Such that I just have to import the package and the module can be used for validating russian text or japanese text Regards, Sonal. -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe and libxml
Amaury Forgeot d'Arc írta: Laszlo Nagy a écrit : I wrote a little win32 console application that uses libxml2. It is working fine. If I create an .exe version, I get this error when I try to start the program: Traceback (most recent call last): File MyProgram.py, line 3, in ? File mylib\item.pyc, line 5, in ? ImportError: dynamic module does not define init function (initlibxml2) What is wrong here? Thanks A quick Google search reveals a thread in the py2exe-users list: http://aspn.activestate.com/ASPN/Mail/Message/py2exe-users/3180430 It seems a regression since py2exe 0.6.5, already corrected in CVS trunk. And according to another post, version 0.6.3 works fine: http://permalink.gmane.org/gmane.comp.python.py2exe/1502 Thank you. I need to downgrade until they fix the problem. :-( -- http://mail.python.org/mailman/listinfo/python-list
Add NTLM proxy authentication to urllib2
Hi, I have to make internet connections through an ISA proxy server that use NTLM or Kerberos authorization method. I've found a program in python called ntlmaps that act like a proxy and could make the NTLM authentication, but you have to run it and make all your connection through it, not an optimal solution. So what I really need is an enhanced urllib2 that support NTLM or Kerberos. I've found that pywin32 could manage NTLM encryption with the sspi module but I've no idea how to implement it in urllib2, NTLM authentication use a 'Token dance' between client and server. Anyone has an experience, a demo or an idea to share ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: testing for valid reference: obj vs. None!=obs vs. obj is not None
Carl Banks wrote: Bruno Desthuilliers wrote: In python, assignement is a statement, not an expression, so there's no way you could write 'if obj = None' by mistake (- syntax error). So this style is unpythonic. Also, None is a singleton, and identity test is way faster than equality test. Playing Devil's advocate here: if you were to write x!=None, then x's __eq__ method is invoked, which might not account for the possibility that the other operand is None. However, if you write None!=x, then None's __eq__ method is invoked, which accounts for any given type. Well... Since we all know it should be an identity test anyway... g -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')]) -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Steve Holden [EMAIL PROTECTED] writes: You write as though the GIL was invented to get in the programmer's way, which is quite wrong. It's there to avoid deep problems with thread interaction. Languages that haven't bitten that bullet can bite you in quite nasty ways when you write threaded applications. And yet, Java programmers manage to write threaded applications all day long without getting bitten (once they're used to the issues), despite usually being less skilled than Python programmers ;-). Contrary to your apparent opinion, the GIL has nothing to do with reference-counting. I think it does, i.e. one of the GIL's motivations was to protect the management of reference counts in CPython, which otherwise wasn't thread-safe. The obvious implementation of Py_INCREF has a race condition, for example. The GIL documentation at http://docs.python.org/api/threads.html describes this in its very first paragraph. Will the madness never end? This reveals an opinion of the development team that's altogether too low. I believe the GIL was introduced for good reasons. The GIL was an acceptable tradeoff when it was first created in the previous century. First of all, it gave a way to add threads to the existing, non-threadsafe CPython implementation without having to rework the old code too much. Second, Python was at that time considered a scripting language and there was less concern about writing complex apps in it, especially multiprocessing apps. Third, multiprocessor computers were themselves exotic, so people who wanted to program them probably had exotic problems that they were willing to jump through hoops to solve. These days, even semi-entry-level consumer laptop computers have dual core CPU's, and quad Opteron boxes (8-way multiprocessing using X2 processors) are quite affordable for midrange servers or engineering workstations, and there's endless desire to write fancy server apps completely in Python. There is no point paying for all that multiprocessor hardware if your programming language won't let you use it. So, Python must punt the GIL if it doesn't want to keep presenting undue obstacles to writing serious apps on modern hardware. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it just me, or is Sqlite3 goofy?
[EMAIL PROTECTED] wrote: Probably just me. I've only been using Access and SQL Server for 12 years, so I'm sure my opinions don't count for anything. SQLite never pretended to be a full-blown RDBMS - just a lightweight simple embedded database as SQL-compliant as possible. In it's category, it beats Access and MySQL hands down. Now if you want a real RDBMS, you've just failed to choose the right tool. May I suggest PostgreSQL ? (snip useless rant) -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')]) -- http://mail.python.org/mailman/listinfo/python-list
Re: why have to from compiler import *
[EMAIL PROTECTED] wrote: Hi, why does import compiler compileFile(foo.py) complain name 'compileFile' not defined. Probably because it's not ? import modulename imports the name modulename in the current namespace. Then modulename let you access all the names defined in modulename namespace. So in you're case, it should be: import compiler compiler.compileFile(foo.py) But from compiler import * works. from modulename import somename directly loads somename into the current namespace. The 'import *' loads all public names from modulename. And FWIW it's usually considered bad style (potential name clash, and can makes hard to tell where a name is defined...) HTH -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')]) -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Content-Disposition in HTTP download
[EMAIL PROTECTED] wrote: What is the correct way to download a file through HTTP and save it to the file name suggested by Content-Disposition? Perhaps something along the lines of the following? url = r'http://www.4so9.com/cauca/files/ban-doc/francois/stingray/198%20lb%20stingray%201%20.JPG' proxy = 'proxy02:8080' import httplib c = httplib.HTTPConnection(proxy) c.request('GET', url) resp = c.getresponse() for k in resp.msg.keys(): ... print resp.msg.getallmatchingheaders(k) ... ['Content-Length: 64632\r\n'] ['Proxy-Connection: close\r\n'] ['X-Cache: HIT from SPSweb\r\n'] ['Accept-Ranges: bytes\r\n'] ['Server: Apache/2.0.51 (Fedora)\r\n'] ['Last-Modified: Fri, 03 Dec 2004 16:57:30 GMT\r\n'] ['ETag: 3b2375-fc78-8c13280\r\n'] ['Date: Tue, 05 Sep 2006 10:35:48 GMT\r\n'] ['Content-Type: image/jpeg\r\n'] ['Age: 31440\r\n'] data = resp.fp.read() len(data) 64632 data[:100] '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x02\x02\x00\x00\x00\x00\x00\x00\xff\xe1\x057Exif\x00\x00II*\x00\x08\x00\x00\x00\t\x00\x0f\x01\x02\x00\x06\x00\x00\x00z\x00\x00\x00\x10\x01\x02\x00\x13\x00\x00\x00\x80\x00\x00\x00\x12\x01\x03\x00\x01\x00\x00\x00\x01\x00\x00\x00\x1a\x01\x05\x00\x01\x00\x00\x00\x93\x00\x00\x00\x1b\x01\x05\x00\x01\x00\x00\x00\x9b\x00\x00\x00' resp.fp.close() -- http://mail.python.org/mailman/listinfo/python-list
Re: newbie pipe question
[EMAIL PROTECTED] wrote: Hi I want to write a python script that accepts input ( a single line of text) from another program (squid proxy) and sends back output ( a single line of text). I am not sure how to go about this cheers David If you want the script to recieve this line in stdin and write the output to stdout, you can use the sys.stdin and sys.stdout file objects. You can also just use print ... to write to stdout. Something like this is simple and readable: input_line = sys.stdin.readline() processing... print output_line - Tal -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
4 Sep 2006 19:19:24 -0700, Sandra-24 [EMAIL PROTECTED]: If there was a mod_dotnet I wouldn't be using CPython anymore. I guess you won't be using then: http://www.mono-project.com/Mod_mono -- Felipe. -- http://mail.python.org/mailman/listinfo/python-list
Minidom XML output - attributes in wrong order ?
I'm very new to Python, so consider this a silly newbie question... Anyway, I'm building a small application to generate a XML. Using document from minidom, I'm doing something like : from xml.dom.minidom import Document doc = Document() c = doc.createElement(sometest) doc.appendChild(c) tmp = doc.createElement(info) tmp.setAttribute(vehicle, car) tmp.setAttribute(x-ray , 100-1) tmp.setAttribute(age, 30) c.appendChild(tmp) print doc.toprettyxml(indent= ) What it then prints out is : ?xml version=1.0 ? sometest info age=30 vehicle=car x-ray =100-1/ /sometest What I expected was : info vehicle=car x-ray=100-1 age=30/ So it seems the dom module sorts the attributes alphabetically. Is there any way I can prevent it from doing that ? What I want is to list them out in the same order as they are added in the code... Thanks, Peter -- http://mail.python.org/mailman/listinfo/python-list
Check XML Without any DTD or schema.
Hi All. I'm newbee. I try to check syntax any XML file. I don't have any dtd or shema file to this xml. Is this possible that I check syntax in any xml file in python. Regards, Dreamen -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax suggestion.
Saluton! Alex Martelli wrote: GVIM (and the normal Python interpreter) work better for me: to perform such a task, I would always write (and run) a script, of course (the purpose of the chroot step is somewhat mysterious here, btw). If I have to perform a strange and complex task once, it's likely that I will have to perform some variant of it again in the future, and having the script around will make it easy to edit and tweak. Furthermore, having the script around can be a useful indicator when I'm later trying to reconstruct exactly what it is that I did. And that's what any concious humain will do in such situation. What I ment is that, sometimes, you have to work in real time and have no time to code-test-debug-... cycle. For example when monitoring or forging some IP packets (you can fake a fantom Sun workstation in your home network like that ;) and need a realtime custom check function or when you're using your computer as a desk scientific calculator you'd like to have a flexible, powerfull and light-weight-syntax interpretted programming language. That language would be with no doubt Python! But, why not, with lighter syntax. Adiaux! Samir -- http://mail.python.org/mailman/listinfo/python-list
[ANN] RuPy 2007 - Python Ruby Conference
RuPy 2007 Python Ruby Conference Poznan, Poland April 7-8, 2007 RuPy is a Python Ruby conference. It will be held at Adam Mickiewicz University, in Poznan, Poland, so it is relatively accessible from both the East and the West of Europe. The philosophy of RuPy is to put together Python Ruby experts with young programmers and to provide a good communication channel for East-West exchange of prospective ideas. -- Call For Participation -- We would like to invite you to join us for two days of Python Ruby fun. We are looking for speakers willing to share their knowledge and experience, talk about new solutions and show new developments. Potential presenters should submit an abstract to: rupy-talks at wmid.amu.edu dot pl by November, 31th 2006 for consideration. If you have any special presentation needs, let us know. For more details check our site: http://rupy.wmid.amu.edu.pl Best regards, -- Jakub P. Nowak -- http://mail.python.org/mailman/listinfo/python-list
Higher-level OpenGL modules
Greetings, Does anybody know of or is working on any python modules that allow for a direct but higher-level interface to OpenGL? For example, quick functions to draw lines, curves, and basic shapes; define hsb color mode; fill and stroke operations; easy loading of images, svg files, etc (much like the processing language - http://www.processing.org/reference/index.html). The closest thing I could find was devachan - http://www.cesaremarilungo.com/sw/devachan/, but its very limited. Any response would be greatly appreciated. Thanks Leon -- http://mail.python.org/mailman/listinfo/python-list
Re: why have to from compiler import *
[EMAIL PROTECTED] wrote: Hi, why does import compiler compileFile(foo.py) complain name 'compileFile' not defined. But from compiler import * works. Why? (I did read the tutorial, it seems to say import module should work. Thank you, Mark I did some ascii art to show what happenss to your namespace as you import from a module in a few ways. (You'll need to view this in a NON-proportional font). You say you've read the docs at: http://docs.python.org/tut/node8.html or http://docs.python.org/ref/import.html Heres my 'art': module1.py: O-O |moduleFunc1 | |moduleClass1 | | class1Method1 | | class1Method2 | |moduleFunc2 | |moduleVar1 | |moduleVar2 | O-O # Empty namespace: \-/ || || || || || || || /-\ import module1 # namespace becomes: \-/ |module1.moduleFunc1 | |module1.moduleClass1: | | class1Method1 | | class1Method2 | |module1.moduleFunc2 | |module1.moduleVar1 | |module1.moduleVar2 | /\ from module1 import * # namespace becomes: \-/ |moduleFunc1 | |moduleClass1 | | class1Method1 | | class1Method2 | |moduleFunc2 | |moduleVar1 | |moduleVar2 | /-\ from module1 import moduleFunc1, muduleVar2 # namespace becomes: \-/ |moduleFunc1 | |moduleVar2 | | | /-\ from module1 import moduleClass1 as C1 # namespace becomes \-/ |C1 |# C1 === module1.moduleClass1 | | /-\ - Paddy. P.S. I'm playing with http://www.jave.de The Java Ascii Versatile Editor. -- http://mail.python.org/mailman/listinfo/python-list
Re: Check XML Without any DTD or schema.
[EMAIL PROTECTED] wrote: I'm newbee. I try to check syntax any XML file. I don't have any dtd or shema file to this xml. Is this possible that I check syntax in any xml file in python. There are two forms of checking xml-documents: - well-formedness, which means that the document adheres to the xml syntax, that open tags are properly closed and tags in general form a tree structure. Maybe some other things too, but that is the gist of it. - validity according to a schema/dtd, which is only possible to check for well-formed documents The first you check by simply opening a file using a xml parser. The second is only possible in presence of a schema-document and a validating parser - which not all are. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Higher-level OpenGL modules
Leon wrote: http://www.processing.org/reference/index.html). The closest thing I could find was devachan - Hava a look at Amanith http://www.amanith.org OpenGL is that low level by design. Everything beyond is to be packed into other libraries. Wolfgang Draxinger -- E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867 GPG key FP: 2FC8 319E C7D7 1ADC 0408 65C6 05F5 A645 1FD3 BD3E -- http://mail.python.org/mailman/listinfo/python-list
Re: why have to from compiler import *
Paddy [EMAIL PROTECTED] wrote: import module1 # namespace becomes: \-/ |module1.moduleFunc1 | |module1.moduleClass1: | | class1Method1 | | class1Method2 | |module1.moduleFunc2 | |module1.moduleVar1 | |module1.moduleVar2 | /\ It would be more accurate to say: # namespace becomes \-/ |module1 | | | /-\ -- http://mail.python.org/mailman/listinfo/python-list
Re: Access elements from nested tuples
On 2006-09-04, Tim Chase [EMAIL PROTECTED] wrote: Hi, [nested tuples] thanks - I should not post before 8 am or 10 pm ... Regards Georg Sauthoff -- http://mail.python.org/mailman/listinfo/python-list
Testing a website with HTTPS login and cookies
Hi everyone, I want to create a test that will do a proper login test to a web site but I need some pointers. I need to login to the website by accessing an https url and posting to that, which should return a very small 302 reply with the address of the internal page. I need to take that page href and then access it, if I can do all that then the test passes. Of course because I have to access two urls I also need cookies for session handling. I've already tried bash which would have worked but for the cookie handling and webinject which is written in Perl, but this doesn't do exactly what I want in terms of output so I'd rather write something myself. (I'm also curious as to the best way to do this) If anybody knows how to do this could they please give me a quick pointer and tell me what libraries I need to go read up on? Thanks Hari -- http://mail.python.org/mailman/listinfo/python-list
HTTP Server Root Folder
Hi All, I have this BaseHTTPServer.HTTPServer that is located at C:\ (im on Windows XP), when i run the program (httpserver.pyw) from the Run Dialog as C:\httpserver.pyw the root folder (\) for http server is C:\, but when i add an entry to Registry Run so that it runs at boot time, the root folder becomes C:\Documents and Settings\username ? Does anyone know what the problem is? Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: Minidom XML output - attributes in wrong order ?
So it seems the dom module sorts the attributes alphabetically. Is there any way I can prevent it from doing that ? What I want is to list them out in the same order as they are added in the code... I don't know how to do what you ask, I'm just here to warn you that you shouldn't rely on the order of attributes in the document in any way, because this is implementation dependent. If you need to preserve order of some items -- use child elements instead of attributes. -- Regards, Maxim Sloyko -- http://mail.python.org/mailman/listinfo/python-list
Re: CONSTRUCT -
Georg Brandl wrote: lazaridis_com wrote: Georg Brandl wrote: lazaridis_com wrote: I would like to fulfill the following task: The construct: if __name__ == '__main__': should be changed to something like: if identifier.name == '__main__': The term identifier should be selected based on the meaning of the __double-underscore-enclosure__ of the entities. ... import sys class _identifier: def __getattr__(self, name): return sys._getframe(1).f_globals['__%s__' % name] identifier = _identifier() ok, I understand. this one would work with modules. but how would look a more general solution, which would work with objects too? Why can't you try to come up with something yourself? You should have had enough exposure to the Python language by now. Georg I am not a (python) domain expert. Thus I am asking here for available standard-solutions, before I implement an own solution. -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLObject or SQLAlchemy?
Bruno Desthuilliers wrote: lazaridis_com wrote: Ο/Η Bruno Desthuilliers έγραψε: lazaridis_com wrote: John Salerno wrote: Are there any major differences between these two? It seems they can both be used with TurboGears, and SQLAlchemy with Django. I'm just wondering what everyone's preference is, and why, and if there are even more choices for ORM. Thanks. You can review the Persit Case, which will shortly evaluate the stated ORM's: http://case.lazaridis.com/wiki/Persist It is possibly of importance to remember some requirements which should be relevant for an persistency mechanism targetting an OO language: RDBMS are not persistency mechanism, they are data management tools. possibly. but this is not relevant, as the Persist case does not deal with RDBMS. Then your post is irrelevant since there's a clear indication that the OP question was about RDBMS integration in Python (hint: SQLObject and SQLAlchemy both start with 'SQL'). ... Of course it's relevant. I'm just wondering what everyone's preference is, and why, and if there are even more choices for ORM. The persist case evaluates python persistency systems (or mechanisms), and will show my personal preference: Object Oriented Persistency Systems (this includes OODBMS, Object-Relational-Mappers, and others). http://case.lazaridis.com/wiki/Persist . -- http://mail.python.org/mailman/listinfo/python-list
Re: CONSTRUCT -
lazaridis_com wrote: Georg Brandl wrote: lazaridis_com wrote: Georg Brandl wrote: lazaridis_com wrote: I would like to fulfill the following task: The construct: if __name__ == '__main__': should be changed to something like: if identifier.name == '__main__': The term identifier should be selected based on the meaning of the __double-underscore-enclosure__ of the entities. ... import sys class _identifier: def __getattr__(self, name): return sys._getframe(1).f_globals['__%s__' % name] identifier = _identifier() ok, I understand. this one would work with modules. but how would look a more general solution, which would work with objects too? Why can't you try to come up with something yourself? You should have had enough exposure to the Python language by now. Georg I am not a (python) domain expert. Thus I am asking here for available standard-solutions, before I implement an own solution. There is no standard solution for the problem you mention. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: HTTP Server Root Folder
placid wrote: Hi All, I have this BaseHTTPServer.HTTPServer that is located at C:\ (im on Windows XP), when i run the program (httpserver.pyw) from the Run Dialog as C:\httpserver.pyw the root folder (\) for http server is C:\, but when i add an entry to Registry Run so that it runs at boot time, the root folder becomes C:\Documents and Settings\username ? Does anyone know what the problem is? Yes. Rather obviously, these two different ways of running programs assert different working directories for the program. A simple way around this would be to have your program make an os.chdir() call to ensure the correct working directory before it starts the server. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Finding name of variable?
Hi,I am writing a specialized xml serialization function, and I would like to be able to serialize the value of a simple object with the object name as the tag. For example: first_name = 'Fred' sXML = my_xml_serializer(first_name) should result in sXML = 'first_nameFred/first_name'I can get class and field names, but how do I find the name of a simple variable?Thanks!- Gardner -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing a website with HTTPS login and cookies
Hari Sekhon wrote: If anybody knows how to do this could they please give me a quick pointer and tell me what libraries I need to go read up on? One word. Selenium. -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding name of variable?
2006-09-05 15:49 +0200, Gardner Pomper [EMAIL PROTECTED]: Hi, I am writing a specialized xml serialization function, and I would like to be able to serialize the value of a simple object with the object name as the tag. For example: first_name = 'Fred' sXML = my_xml_serializer(first_name) should result in sXML = 'first_nameFred/first_name' I can get class and field names, but how do I find the name of a simple variable? A recent thread[1] might be a useful starting point. [1] how do you get the name of a dictionary? URL: http://mail.python.org/pipermail/python-list/2006-August/357006.html -- Gonzalo HIGUERA DÍAZ [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Test for number?
On 2006-09-04, George Sakkis [EMAIL PROTECTED] wrote: Dr. Pastor wrote: In the following code I would like to ascertain that x has/is a number. What the simplest TEST should be? (Could not find good example yet.) --- x=raw_input('\nType a number from 1 to 20') if TEST : Do_A else: Do_B --- Thanks for any guidance. x=raw_input('\nType a number from 1 to 20') try: x = int(x) if x1 or x20: raise ValueError() except ValueError: Do_B else: Do_A If you want to distinguish between the two error cases (not a number vs number not in [1,20]), handle the second one as Do_C instead of raising ValueError. Is the original value of x available in Do_B and Do_A, or will it have been clobbered before getting there? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Steve Holden wrote: Quite right too. You haven't even sacrificed a chicken yet ... Hopefully we don't get to that point. You write as though the GIL was invented to get in the programmer's way, which is quite wrong. It's there to avoid deep problems with thread interaction. Languages that haven't bitten that bullet can bite you in quite nasty ways when you write threaded applications. I know it was put there because it is meant to be a good thing. However, it gets in my way. I would be perfectly happy if it were gone. I've never written code that assumes there's a GIL. I always write my code with all shared writable objects protected by locks. It's far more portable, and a good habit to get into. You realize that because of the GIL, they were discussing (and may have already implemented) Java style synchronized dictionaries and lists for IronPython simply because python programmers just assume they are thread safe thanks to the GIL. I always hated that about Java. If you want to give me thread safe collections, fine, they'll be nice for sharing between threads, but don't make me use synchronized collections for single-threaded code. You'll notice the newer Java collections are not synchronized, it would seem I'm not alone in that opinion. Contrary to your apparent opinion, the GIL has nothing to do with reference-counting. Actually it does. Without the GIL reference counting is not thread safe. You have to synchronize all reference count accesses, increments, and decrements because you have no way of knowing which objects get shared across threads. I think with Python's current memory management, the GIL is the lesser evil. I'm mostly writing this to provide a different point of view, many people seem to think (previously linked blog) that there is no downside to the GIL, and that's just not true. However, I don't expect that the GIL can be safely removed from CPython. I also think that it doesn't matter because projects like IronPython and PyPy are very likely the way of the future for Python anyway. Once you move away from C there are so many more things you can do. I think the suggestion was rather that abandoning Python because of the GIL might be premature optimisation. But since you appear to be sticking with it, that might have been unnecessary advice. I would never abandon Python, and I hold the development team in very high esteem. That doesn't mean there's a few things (like the GIL, or super) that I don't like. But overall they've done an excellent job on the 99% of things the've got right. I guess we don't say that enough. I might switch from CPython sometime to another implementation, but it won't be because of the GIL. I'm very fond of the .net framework as a library, and I'd also rather write performance critical code in C# than C (who wouldn't?) I'm also watching PyPy with interest. -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: OS X and Python - wxPython has forced a rehash of my approach
hiaips wrote: Outdated??? It's Python 2.4.3 (and they already have a build for 2.5rc1), so I'm not sure what you mean. There have been a couple of releases of Python 2.4.3 universal on OS X.The first one was quietly posted for download from one of the developers' .Mac account, and announced only on the MacPython list, with an invitation for feedback. It probably should have been tagged release candidate, but it wasn't. Someone grabbed it and posted it at python.org. A week or so later, a significantly faster/optimized release of Python 2.4.3 was announced on the MacPython list and posted for download at pythonmac.org. That's the release that the Mac community considers to be the official universal release. It looks like the earlier release is what is available at python.org; it hasn't been updated. That release was made on March 30, while the faster release was made on April 7 (or thereabouts). Once 2.5 is out, it will probably be moot. The universal build of Python 2.4.3 is currently a fork from the main Python code base; the Mac developers are concentrating on merging the changes in for the 2.5 release. No further work is being done on 2.4.3 as far as I know. -- Kevin Walzer Poetic Code http://www.kevin-walzer.com -- http://mail.python.org/mailman/listinfo/python-list
Re: OS X and Python - wxPython has forced a rehash of my approach
hiaips wrote: Outdated??? It's Python 2.4.3 (and they already have a build for 2.5rc1), so I'm not sure what you mean. Also, for what it's worth, I strongly recommend the packages hosted at pythonmac.org; these are built and tested by the core MacPython developers. -- Kevin Walzer Poetic Code http://www.kevin-walzer.com -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
bayerj wrote: Then you can use POSH [1] to share data and objects. Do you use POSH? How well does it work with current Python? Any major gotchas? I think POSH looks like a great thing to have, but the latest version is an alpha from over three years ago. Also, it only runs on *nix systems. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list
Re: are there any lib for receive hotmail ?
poplib cannot receive hotmail. Paul McGuire wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] thanks. poplib -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Sandra However, I don't expect that the GIL can be safely removed from Sandra CPython. It was removed at one point in the dim, dark past (circa Python 1.4) on an experimental basis. Aside from the huge amount of work, it resulted in significantly lower performance for single-threaded apps (that is, the common case). Maybe more effort should have been put in at that time to improve performance, but that didn't happen. Much more water has gone under the bridge at this point, so extracting the GIL from the core would be correspondingly more difficult. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Felipe Almeida Lessa wrote: 4 Sep 2006 19:19:24 -0700, Sandra-24 [EMAIL PROTECTED]: If there was a mod_dotnet I wouldn't be using CPython anymore. I guess you won't be using then: http://www.mono-project.com/Mod_mono Oh I'm aware of that, but it's not what I'm looking for. Mod_mono just lets you run ASP.NET on Apache. I'd much rather use Python :) Now if there was a way to run IronPython on Apache I'd be interested. -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Hi all, And yet, Java programmers manage to write threaded applications all day long without getting bitten (once they're used to the issues), despite usually being less skilled than Python programmers ;-). These days, even semi-entry-level consumer laptop computers have dual core CPU's, and quad Opteron boxes (8-way multiprocessing using X2 processors) are quite affordable for midrange servers or engineering workstations, and there's endless desire to write fancy server apps completely in Python. There is no point paying for all that multiprocessor hardware if your programming language won't let you use it. So, Python must punt the GIL if it doesn't want to keep presenting undue obstacles to writing serious apps on modern hardware. True GIL implementation must have got its own good causes as it it designed but as language evolves its very essential that one increases the scope such that it fits into many usage areas(eg. scientific applications using multiprocessors etc.). In the modern scientific age where __multiprocessor_execution_environment__ is quite common, i feel there is a need to rethink abt the introduction of true parallelization capabilities in python. I know many of my friends who didnot choose python for obvious reasons of the nature of thread execution in the presence of GIL which means that one is wasting sophisticated hardware resources. ## if __name__ == ''__multiprocessor_execution_environment__': for python_version in range(python2.4.x, python3.x, x): if python_version.GIL: print 'unusable for computation intensive multiprocessor architecture' else: print cmp(python,java) regards, KM -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Sandra-24 wrote: You seem to be confused about the nature of multiple-process programming. If you're on a modern Unix/Linux platform and you have static read-only data, you can just read it in before forking and it'll be shared between the processes.. Not familiar with *nix programming, but I'll take your word on it. You can do the same on Windows if you use CreateProcessEx to create the new processes and pass a NULL SectionHandle. I don't think this helps in your case, but I was correcting your impression that you'd have to physically double the computer's memory for a dual core, or quadruple it for a quadcore. That's just not even near true. Threads are way overused in modern multiexecution programming. The snip It used to run on windows with multiple processes. If it really won't now, use an older version or contribute a fix. First of all I'm not in control of spawning processes or threads. Apache does that, and apache has no MPM for windows that uses more than 1 process. As I said, Apache used to run on Windows with multiple processes; using a version that supports that is one option. There are good reasons not to do that, though, so you could be stuck with threads. Secondly Superior is definately a matter of opinion. Let's see how you would define superior. Having memory protection is superior to not having it--OS designers spent years implementing it, why would you toss out a fair chunk of it? Being explicit about what you're sharing is generally better than not. But as I said, threads are a better solution if you're sharing the vast majority of your memory and have complex data structures to share. When you're starting a new project, really think about whether they're worth the considerable tradeoffs, though, and consider the merits of a multiprocess solution. 3) Rewrite my codebase to use some form of shared memory. This would be a terrible nightmare that would take at least a month of development time and a lot of heavy rewriting. It would be very difficult, but I'll grant that it may work if done properly with only small performance losses. It's almost certainly not worth rewriting a large established codebasen. I would find an easier time, I think, porting mod_python to .net and leaving that GIL behind forever. Thankfully, I'm not considering such drastic measures - yet. The threads vs. processes thing isn't strongly related to the implementation language (though a few languages like Java basically take the decision out of your hands). Moving to .NET leaves you with the same questions to consider before making the decision--just working in C# doesn't somehow make threads the right choice all the time. Why on earth would I want to do all of that work? Just because you want to keep this evil thing called a GIL? No, I agreed that the GIL is a bad thing for some applications. My suggestion is in python 3 ditch the ref counting, use a real garbage collector I disagree with this, though. The benefits of deterministic GC are huge and I'd like to see ref-counting semantics as part of the language definition. That's a debate I just had in another thread, though, and don't want to repeat. Now, the GIL is independent of this; if you really need threading in your situation (you share almost everything and have hugely complex data structures that are difficult to maintain in shm) then you're still going to run into GIL serialization. If you're doing a lot of work in native code extensions this may not actually be a big performance hit, if not it can be pretty bad. Actually, I'm not sure I understand you correctly. You're saying that in an environment like apache (with 250 threads or so) and my hugely complex shared data structures, that the GIL is going to cause a huge performance hit? I didn't say that. It can be a big hit or it can be unnoticeable. It depends on your application. You have to benchmark to know for sure. But if you're trying to make a guess: if you're doing a lot of heavy lifting in native modules then the GIL may be released during those calls, and you might get good multithreading performance. If you're doing lots of I/O requests the GIL is generally released during those and things will be fine. If you're doing lots of heavy crunching in Python, the GIL is probably held and can be a big performance issue. Since your app sounds like it's basically written, there's not much cause to guess; benchmark it and see if it's fast enough or not. If so, don't spend time and effort optimizing. -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Paul Rubin wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] writes: If it's read/write data or you're not on a Unix platform, you can use shared memory to shared it between many processes. Threads are way overused in modern multiexecution programming. The decision on whether to use processes or threads should come down to whether you want to share everything, or whether you have specific pieces of data you want to share. Shared memory means there's a byte vector (the shared memory region) accessible to multiple processes. The processes don't use the same machine addresses to reference the vector. Any data structures (e.g. those containing pointers) shared between the processes have to be marshalled in and out of the byte vector instead of being accessed normally. I think it's even worse. The standard Python library offers shared memory, but not cross-process locks. Sharing read-write memory looks like an automatic race condition. I guess one could implement one of the primitive spin-lock based mutual exclusion algorithms, but I think even that would depend on non-portable assumptions about cache consistency. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
km [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I know many of my friends who did not choose python for obvious reasons of the nature of thread execution in the presence of GIL which means that one is wasting sophisticated hardware resources. It would probably be easier to find smarter friends than to remove the GIL from Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
True, since smartness is a comparison, my friends who have chosen java over python for considerations of a true threading support in a language are smarter, which makes me a dumbo ! :-) KM On 9/5/06, Richard Brodie [EMAIL PROTECTED] wrote: km [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I know many of my friends who did not choose python for obvious reasons of the nature of thread execution in the presence of GIL which means that one is wasting sophisticated hardware resources. It would probably be easier to find smarter friends than to remove the GIL from Python. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: are there any lib for receive hotmail ?
叮叮当当 wrote: poplib cannot receive hotmail. Not true: http://www.macworld.com/news/2002/06/18/hotmail/index.php You need to pay for that, but they do offer pop. And receiving hotmail (or any outher webmail) using scraping techniques is a daunting task, to say the least - you should forget about that IMHO. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: are there any lib for receive hotmail ?
And receiving hotmail (or any outher webmail) using scraping techniques is a daunting task, to say the least - you should forget about that IMHO. There's a perl project called gotmail that will do the scraping to dump in a local mailbox file (I don't remember whether it's MH or mbox format). You can snag it at http://gotmail.sf.net Thus, there's evidence that Hotmail can be scraped, but it seems they have a never-ending battle against Hotmail, trying to keep up with changes. I don't know of any Python projects doing the same sort of thing. It might not be too hard to port the Perl project over to Python, but one would be an extra level removed from scraping Hotmail, playing catchup not only with Hotmail, but then porting the latest fixes from Gotmail. There are a couple other Hotmail-to-mbox scrapers I've heard of, but haven't tried. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
km [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] True, since smartness is a comparison, my friends who have chosen java over python for considerations of a true threading support in a language are smarter, which makes me a dumbo ! :-) No, but I think you making unwise assumptions about performance. You have to ask yourself: is Amdahl's law really hurting me? In some situations Python could no doubt benefit from fine grained locking. However, it's likely that scientific programming is not typically one of them, because most of the heavy lifting is done in C or C++ extensions which can run in parallel if they release the GIL. Or you are going to use a compute farm, and fork as many worker processes as you have cores. You might find these slides from SciPy 2004 interesting: http://datamining.anu.edu.au/~ole/pypar/py4cfd.pdf -- http://mail.python.org/mailman/listinfo/python-list
Re: newbe question about removing items from one file to another file
You don't need the setup command. Just place SE.py and SEL.py into a path where the import can find it. Also make sure SE.py and SEL.py are spelled exactly like this. Linux requires the extension to be lower case, as I was myself made aware of by an alert person who was also experiencing import problems. I must confess that my fist uploads were upper case (SE.PY). I instantaneously replaced the upload with corrected spelling and apologize for the trouble the mistake may be causing. Fortunately correcting it is a small matter. Have you tried to run the function at all? It produces the same result. Made case-insensitive (if need be) I'd prefer the function. It is more economical, since it doesn't require an extra import. It surely runs faster too (if that matters). Frederic - Original Message - From: [EMAIL PROTECTED] Newsgroups: comp.lang.python To: python-list@python.org Sent: Monday, September 04, 2006 10:52 PM Subject: Re: newbe question about removing items from one file to another file I am have to be able to distribute se with the project in order to use it I started with import se but I did not use the setup command when I comment out import se the program works and when I use import se everything connected to the library crashes on the import line.. Anthra Norell wrote: - Original Message - From: [EMAIL PROTECTED] Newsgroups: comp.lang.python To: python-list@python.org Sent: Monday, September 04, 2006 4:58 AM Subject: Re: newbe question about removing items from one file to another file Anthra Norell wrote: Dexter, Here's a function that screens out all instrument blocks and puts them into a dictionary keyed on the instrument number: def get_instruments (file_name): etc. CsOptions -W -d -o tone.wav /CsOptions ... etc. I cut and pasted this.. It seems to be crashing my program.. I am not sure that I have all the right imports.. seems to be fine when I go to an older version of the file... I uploaded it onto source forge. https://sourceforge.net/project/showfiles.php?group_id=156455package_id=201306release_id=444362 http://www.dexrow.com Eric (Eric or Dexer?) This thread seems to have split. So let me reiterate: please copy the output when you cut, paste and run. If you have an import problem it must be on the other side of your interface with SE, because I don't import anything and SE imports what it needs. Frederic -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: are there any lib for receive hotmail ?
Tim Chase wrote: And receiving hotmail (or any outher webmail) using scraping techniques is a daunting task, to say the least - you should forget about that IMHO. There's a perl project called "gotmail" that will do the scraping to dump in a local mailbox file (I don't remember whether it's MH or mbox format). You can snag it at http://gotmail.sf.net Thus, there's evidence that Hotmail can be scraped, but it seems they have a never-ending battle against Hotmail, trying to keep up with changes. I don't know of any Python projects doing the same sort of thing. It might not be too hard to port the Perl project over to Python, but one would be an extra level removed from scraping Hotmail, playing catchup not only with Hotmail, but then porting the latest fixes from Gotmail. There are a couple other Hotmail-to-mbox scrapers I've heard of, but haven't tried. -tkc I know this isn't technically helping, but why use hotmail when gmail is so much better and gives you pop access? Even old yahoo gives you pop access to your mailbox Hari Sekhon -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
[EMAIL PROTECTED] wrote: Sandra However, I don't expect that the GIL can be safely removed from Sandra CPython. It was removed at one point in the dim, dark past (circa Python 1.4) on an experimental basis. Aside from the huge amount of work, it resulted in significantly lower performance for single-threaded apps (that is, the common case). Maybe more effort should have been put in at that time to improve performance, but that didn't happen. Much more water has gone under the bridge at this point, so extracting the GIL from the core would be correspondingly more difficult. Given the effort that GIL-removal would take, I'm beginning to wonder if PyPy doesn't offer a better way forward than CPython, in terms of execution speed improvements returned per developer-hour. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Steve Given the effort that GIL-removal would take, I'm beginning to Steve wonder if PyPy doesn't offer a better way forward than CPython, Steve in terms of execution speed improvements returned per Steve developer-hour. How about execution speed improvements per hour of discussion about removing the GIL? ;-) Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Richard It would probably be easier to find smarter friends than to Richard remove the GIL from Python. And if the friends you find are smart enough, they can remove the GIL for you! Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: How ahead are you guys in the (Python) real world?
(ack! forgot to push the send button several days ago - hopefully this isn't woefully out-of-date now...) neil Based on the number of people still using 2.3, it looks to me like neil there would be interest. aahz Yes; the real question is whether there is enough labor available aahz to make it happen. Just to make it clear for people with an interest in another 2.3 release who might not read python-dev, here's what needs to happen. Someone(s) needs to consider which bug fixes applied to 2.4 (and maybe CVS head) since the last 2.3 release should be applied to the 2.3 branch. That entails a few steps: 1. scan the 2.4 checkins for bug fixes (scanning Misc/NEWS might be sufficient) 2. decide which ones apply to the 2.3 branch (some might not if they were bugs that were introduced in 2.4 or because code structure changes would make it too painful to add to 2.3) 3. work up a patch with test cases against the 2.3 code (simplified by starting with the 2.4 patch in most cases) that implements the fix 4. test the 2.3 branch as patches are applied to make sure there are no regressions against your own code base. All these steps are necessary to some degree, though one person doesn't have to do all four steps for any given bug fix. Any help you can give would be appreciated. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Bryan Olson wrote: I think it's even worse. The standard Python library offers shared memory, but not cross-process locks. File locks are supported by the standard library (at least on Unix, I've not tried on Windows). They work cross-process and are a normal method of interprocess locking even in C code. -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
This seems to be an important issue and fit for discussion in the context of Py3k. What is Guido's opinion?As a developer of a multi-threaded system I would like to know more about these issues, so it's no time wasted for me... ;-) regardsAndreOn 9/5/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Steve Given the effort that GIL-removal would take, I'm beginning toSteve wonder if PyPy doesn't offer a better way forward than CPython, Steve in terms of execution speed improvements returned perSteve developer-hour.How about execution speed improvements per hour of discussion about removingthe GIL? ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it just me, or is Sqlite3 goofy?
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: But watch this: being clueless (but not stupid) is a gift I have for troubleshooting. I tried (incorrectly) to insert another record: cur.execute(insert into book(title, author, published) values ('Dirk Gently''s Holistic Detective Agency','Douglas Adams','1987')) (uDirk Gently's Holistic Detective Agency, u'Douglas Adams', 1987) (uDirk Gently's Holistic Detective Agency, u'Douglas Adams', u'1987') Uhh...how can a database have a different field type for each record? Simple, without a cast when the table is created, the field type is whatever you insert into it. That's how the default must work, each record has a data structure independent of every other record! Wow. Just think of the kind of bugs *that* must cause. Bugs? It's not a bug, it's a feature. And answered as third point in the FAQ: http://www.sqlite.org/faq.html#q3 Oh, so it is This behaviour is by design. I think your whole experience is based on it. But shouldn't a significant feature like that be explained in the Python manuals? Why should I go dig up Sqlite FAQs to learn what should have been in the manuals? Live with it or use a real RDBMS. I don't mind living with it as long as it's documented. If you are so fond of static typing, why are you using Python in the first place? Just see it as consistency -- dynamically typed language → dynamically typed DB columns. ;-) Did you miss this statement in Section 13.13? If switching to a larger database such as PostgreSQL or Oracle is later necessary, the switch should be relatively easy. Obviously, this is a new useage of relatively easy with which I have been previously unaware. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: why have to from compiler import *
Duncan Booth wrote: Paddy [EMAIL PROTECTED] wrote: import module1 # namespace becomes: \-/ |module1.moduleFunc1 | |module1.moduleClass1: | | class1Method1 | | class1Method2 | |module1.moduleFunc2 | |module1.moduleVar1 | |module1.moduleVar2 | /\ It would be more accurate to say: # namespace becomes \-/ |module1 | | | /-\ Possibly, although I purposely wanted to give a flavour of how things might be accessed. - Paddy -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Sandra-24 [EMAIL PROTECTED] wrote: Oh I'm aware of that, but it's not what I'm looking for. Mod_mono just lets you run ASP.NET on Apache. I'd much rather use Python :) Now if there was a way to run IronPython on Apache I'd be interested. Take a look here: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-March/00 2049.html and this thread: http://www.mail-archive.com/users@lists.ironpython.com/msg01826.html -- Lawrence - http://www.oluyede.org/blog Nothing is more dangerous than an idea if it's the only one you have - E. A. Chartier -- http://mail.python.org/mailman/listinfo/python-list
Re: code for the graphics window?
On Saturday 02 September 2006 11:41, you wrote: [EMAIL PROTECTED] wrote: Hi. I'm new to Python . . .very new. I was just wondering, once I've written a program that opens the graphics window and I've got some things going on in the grahics window, how do I display text in the grahics window? I need to be able to display changeable text, so that the words and numbers can be altered with what is going on inside the graphics window. If that doesn't make much sense, maybe I could try sending a bit of the code from my program. A bit of code would certainly help. How did you open this graphics window? Richard Okay, I'm not sure what part of the code is most needed, so I'll just give the whole thing, note that the opening of this graphics window as I called it, occurred in the Maze class. Also note that I am using version 2.4.3 of Python and work in the GUI IDLE. from livewires import * grid_size = 30 margin = grid_size background_colour = Colour.black wall_colour = make_colour(0.6, 0.9, 0.9) pacman_colour = Colour.yellow pacman_size = grid_size * 0.8 pacman_speed = 0.25 food_colour = Colour.red food_size = grid_size * 0.15 ghost_colours = [] ghost_colours.append(Colour.red) ghost_colours.append(Colour.green) ghost_colours.append(Colour.blue) ghost_colours.append(Colour.purple) ghost_speed = 0.25 capsule_colour = Colour.white capsule_size = grid_size * 0.3 scared_colour = Colour.white scared_time = 300 warning_time = 50 ghost_shape = [ ( 0, -0.5 ), ( 0.25, -0.75), ( 0.5, -0.5 ), ( 0.75, -0.75 ), ( 0.75, 0.5 ), ( 0.5, 0.75 ), (-0.5, 0.75 ), (-0.75, 0.5 ), (-0.75, -0.75 ), (-0.5, -0.5 ), (-0.25, -0.75 ) ] # The shape of the maze. Each character # represents a different type of object. # % - Wall # . - Food # o - Capsule # G - Ghost # P - Pacman # Other characters are ignored the_layout = [ %%%, %.%.%.%, %o%%%.%.%%%.%%%.%%%.%.%%%o%, %.%.%..%..%.%.%, %...%%%.%..%..%.%%%...%, %%%.%...%.%.%.%...%.%%%, %...%.%%%.%.%%% %%%.%.%%%.%...%, %.%%%...%GG GG%...%%%.%, %...%.%%%.%.%%%.%.%%%.%...%, %%%.%...%.%.%.%...%.%%%, %...%%%.%..%..%.%%%...%, %.%.%..%..%.%.%, %o%%%.%.%%%.%%%.%%%.%.%%%o%, %.%P%.%, %%% ] class Immovable: def is_a_wall(self): return 0 def eat(self, pacman): pass class Nothing(Immovable): pass class Maze: def __init__(self): self.have_window = 0 self.game_over = 0 self.set_layout(the_layout) def set_layout(self, layout): height = len(layout) width = len(layout[0]) self.make_window(width, height) self.make_map(width, height) self.movables = [] self.food_count = 0 max_y = height - 1 for x in range(width): for y in range(height): char = layout[max_y - y][x] self.make_object((x, y), char) for movable in self.movables: movable.draw() def make_window(self, width, height): grid_width = (width-1) * grid_size grid_height = (height-1) * grid_size screen_width = 2*margin + grid_width screen_height = 2*margin + grid_height begin_graphics(screen_width, screen_height, background_colour) allow_movables() def to_screen(self, point): (x, y) = point x = x*grid_size + margin y = y*grid_size + margin return (x, y) def make_map(self, width, height): self.width = width self.height = height self.map = [] for y in range(height): new_row = [] for x in range(width): new_row.append(Nothing()) self.map.append(new_row) def make_object(self, point, character): (x, y) = point if character == '%': self.map[y][x] = Wall(self, point) elif character == 'P': pacman = Pacman(self, point) self.movables.append(pacman) elif character == '.': self.food_count = self.food_count + 1 self.map[y][x] = Food(self, point) elif character == 'G': ghost = Ghost(self, point) self.movables.append(ghost) elif character == 'o': self.map[y][x] = Capsule(self, point) def finished(self): return self.game_over def play(self): for movable in self.movables: movable.move() sleep(0.05) def object_at(self, point): (x,y ) = point if y 0 or y = self.height: return Nothing() if x 0 or x = self.width: return Nothing() return self.map[y][x] def
Re: threading support in python
Lawrence Oluyede [EMAIL PROTECTED] wrote: Take a look here: http://lists.ironpython.com/pipermail/users-ironpython.com/2006-March/00 2049.html and this thread: http://www.mail-archive.com/users@lists.ironpython.com/msg01826.html Also this: http://www.codeproject.com/useritems/ipaspnet.asp Google is you friend! :-) -- Lawrence - http://www.oluyede.org/blog Nothing is more dangerous than an idea if it's the only one you have - E. A. Chartier -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
Andre This seems to be an important issue and fit for discussion in the Andre context of Py3k. What is Guido's opinion? Dunno. I've never tried channeling Guido before. You'd have to ask him. Well, maybe Tim Peters will know. He channels Guido on a fairly regular basis. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Test for number?
Neil Cerutti wrote: On 2006-09-04, George Sakkis [EMAIL PROTECTED] wrote: x=raw_input('\nType a number from 1 to 20') try: x = int(x) if x1 or x20: raise ValueError() except ValueError: Do_B else: Do_A If you want to distinguish between the two error cases (not a number vs number not in [1,20]), handle the second one as Do_C instead of raising ValueError. Is the original value of x available in Do_B and Do_A, or will it have been clobbered before getting there? In Do_A, x will be an integer between 1 and 20. In Do_B, it depends; if the original input cannot be converted to an int, it will be preserved, otherwise x will be an integer (lower than 1 or larger than 20). George -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it just me, or is Sqlite3 goofy?
I think your whole experience is based on it. But shouldn't a significant feature like that be explained in the Python manuals? Why should I go dig up Sqlite FAQs to learn what should have been in the manuals? I don't know, but I will take a stab at a plausible explanation. First, sqlite support has only been in Python for a month or three. Its first official unveiling will be when 2.5 is released. Second, it's common when wrapping functionality into Python to rely on the documentation for the thing being wrapped. The thinner the wrapper, the more you tend to rely on the underlying documentation. Also, the more functionally rich the thing you've wrapped, the more you rely on the underlying documentation. I wouldn't be at all surprised if the pysqlite author operated under that assumption. That the Python developers didn't pick up on the issue is not surprising. I'm not sure how many of them are (py)sqlite users, probably relatively few. Skip -- http://mail.python.org/mailman/listinfo/python-list
accepting cStringIO in an extension
I want to accept a cStringIO object in a function in a python extension module. How do I do this? e.g., static PyObject *myfunc(PyObject *self, PyObject *args) { PyObject *cstringio; if (!PyArg_ParseTuple(args, O:cStringIO, cstringio)) { PyErr_SetString(PyExc_ValueError, value must be a cstringio); return NULL; } /* how to get at the data buffer or call read() on cstringio? */ } I understand that I probably want PyEval_CallObject(), but I don't know how to get at the read() method of cstringio. Thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list
Programming isn't dangerous...
http://www.sfgate.com/cgi-bin/article.cgi?file=/news/archive/2006/09/05/national/a082618D20.DTL -- Aahz ([EMAIL PROTECTED]) * http://www.pythoncraft.com/ I support the RKAB -- http://mail.python.org/mailman/listinfo/python-list
New 2.5 release date: September 19
Just in case you didn't notice. -- http://mail.python.org/mailman/listinfo/python-list
threading
From what I understand in order to guarantee thread safety Python implements an Global Interpreter Lock. Which removes the concurrency, but provides thread safety. Is Python 2.4 still like this and if I used Python to handle rpc requests and responses would it be efficient in a multithreaded sense. Always listen while another thread sends responses? -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming isn't dangerous...
Aahz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] http://www.sfgate.com/cgi-bin/article.cgi?file=/news/archive/2006/09/05/national/a082618D20.DTL He should have been practicing pair pet care ;-) tjr -- http://mail.python.org/mailman/listinfo/python-list
a Pywin Outlook adress Book Question
Hello Ist there a way to search a Adressbook over Python for a special contact. I know how i read and write a contact, but know i have to search over Python for some contacts, because the adress book has know over 1700 entrys, and it tooks a long time to get them all over the Com object to python. Kai Mayfarth -- http://mail.python.org/mailman/listinfo/python-list
Off topic
- Make Up to $50K - This was my ad a month ago. I didn't make $50k, but I made $14,565, that's $14,555, more than I invested into this little game. I can't believe it. I'm still running the ads and sending emails so maybe next month I will make $50,000. This is so much fun!!! My wife thought I was unrealistic a month ago. I was a little bit, but $14,565 is still o.k., and she likes it. Reply to: [EMAIL PROTECTED] Date: 2006-08-25, 9:17AM PDT +++ EASILY MAKE AS MUCH AS $50K!!! +++ This program is truly simple and successful, just give it a shot. You may have heard of this program (or one similar to it) on Oprah, 20/20 or even in The Wall Street Journal. Quick and simple, $10 is all it takes. The program is an easy step-by-step process that takes virtually no time. Paypal verifies that this very minimal $10 investment is 100% legal. This program may take between 15-45 minutes of your time, but it is most definitely worth it in the long-run as the potential to make thousands is virtually unlimited. Don't throw your hard-earned money away... try this no-risk investment that will help make you thousands of dollars very easily and quickly. To get started just copy this whole page to paste and edit it. Simply follow the instructions below and in 2-3 weeks you could have upwards of $50,000 dollars in your Paypal account or potentially even more! Most people respond to this program because of a) the low investment level ($10 dollars) and b) the high profit potential! There is no limit to the income you can generate from this (as you can sucessfully perform it over and over). If you follow the instructions, you will reach thousands of people! Honesty, Faith, Trust and Integrity are what make this system work. Program Steps Most everyone has heard of PayPal. Anyone with an e-mail address can join for free. If you are not already a PayPal user the first thing you need to do is sign up. Sign up for PayPal at www.paypal.com ... It's very easy to set up and it's free. Just make sure you sign up for (or already have) a Business or Premier account as you may be subject to a monthly income limitation which can slow the program down. Step 1: Send $5 to the first person on the list by using the PayPal Send Money feature, choose service or quasi-cash and include in the e-mail subject line and note PLEASE ADD ME TO YOUR LIST ... This keeps the program safe, secure and legal. Then send another $5 to the 5th person on the list, with the e-mail subject line and note that says, THANK YOU, I'VE JOINED . Step 2: Delete the first e-mail address in the list and place your e-mail address at the bottom. Move the 2nd e-mail address to the 1st position, 3rd to second, 4th to third, and 5th to fourth. Do not try to place yourself in the first place. It will only reach the people you send it to and then your name will be removed from the list! If you do this the way it was designed, it will reach thousands by the time your name gets to the top. Remember to send a $5 dollar donation to the 1st e-mail address and the message PLEASE ADD ME TO YOUR LIST, and send an e-mail with the words THANK YOU I'VE JOINED and the other $5 donation to the 5th person. This helps the 5th person keep track of progress of the letter and continue to send out more e-mails. Here is the list: 1. [EMAIL PROTECTED] 2. [EMAIL PROTECTED] 3. [EMAIL PROTECTED] 4. [EMAIL PROTECTED] 5. [EMAIL PROTECTED] (Make sure you use the same e-mail address that you used to open your PayPal account as this is the way you will succesfully receive payment.) Step 3: Now that you have paid the 1st person and 5th person and sent them both an e-mail, a note and placed your e-mail address in the 5th place, then what you need to do is post your letter. You can post on www.craigslist.org, www.backpage.com, message boards and newsgroups (there are thousands), classifieds and you can even send an e-mail to your e-mail list. Step 4: The 5th person is the guardian of the system!. If there are not at least 20 replies then the 5th person will keep sending/posting the letter until there is. IT IS YOUR JOB AS THE 5TH PERSON ON THE LIST TO ENSURE THERE ARE AT LEAST 20 THANK YOU, IVE JOINED replies. You will receive many thanks and the same blessings when your name is 1st on the list as upwards of 8000 to 15,000 people will send you $5 dollars! Keep in mind the most you will have spent is $10 DOLLARS!! (As the old proverb goes: What goes around comes around!) ___ Testimonials Mary Gaters, Columbus, SC: I only have one thing to say to you: OH MY GOD! I sent out 142 copies total before 20 replied, just like the instructions said. Then I went on a short vacation. When I got back my account had over $32,000 dollars in it already and the money was still coming! I'm still floating on air! I thought the guardian system sounded cheesy, but now I realize
Getting text into the copy-paste buffer...
Strange request, but is there any way to get text into the linux copy-paste buffer from a python script ? I know the standard python libraries won't have that functionality (except as a side-effect, perhaps?), but is there a simple trick that would do it on linux? A command line to get text into the buffer? Using a gui toolkit as a proxy to get text in there? I actually have a need for this, though it sounds bizarre, thanks in advance, -Dave -- Presenting: mediocre nebula. -- http://mail.python.org/mailman/listinfo/python-list
Re: Test for number?
On 2006-09-05, George Sakkis [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-09-04, George Sakkis [EMAIL PROTECTED] wrote: x=raw_input('\nType a number from 1 to 20') try: x = int(x) if x1 or x20: raise ValueError() except ValueError: Do_B else: Do_A If you want to distinguish between the two error cases (not a number vs number not in [1,20]), handle the second one as Do_C instead of raising ValueError. Is the original value of x available in Do_B and Do_A, or will it have been clobbered before getting there? In Do_A, x will be an integer between 1 and 20. In Do_B, it depends; if the original input cannot be converted to an int, it will be preserved, otherwise x will be an integer (lower than 1 or larger than 20). Thanks. I infer from this that in the case that int(x) raises ValueError, that x is guaranteed to be unmodified. -- Neil Cerutti 22 members were present at the church meeting held at the home of Mrs. Marsha Crutchfield last evening. Mrs. Crutchfield and Mrs. Rankin sang a duet, The Lord Knows Why. --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming isn't dangerous...
Darwinism in action! :-P -- http://mail.python.org/mailman/listinfo/python-list
Re: threading
matt From what I understand in order to guarantee thread safety Python matt implements an Global Interpreter Lock. Which removes the matt concurrency, but provides thread safety. Is Python 2.4 still like matt this and if I used Python to handle rpc requests and responses matt would it be efficient in a multithreaded sense. Always listen matt while another thread sends responses? Should be no problem. For all practical purposes the GIL is a problem only if your code is CPU-bound. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
[EMAIL PROTECTED] wrote: You can do the same on Windows if you use CreateProcessEx to create the new processes and pass a NULL SectionHandle. I don't think this helps in your case, but I was correcting your impression that you'd have to physically double the computer's memory for a dual core, or quadruple it for a quadcore. That's just not even near true. Sorry, my bad. What I meant to say is that for my application I would have to increase the memory linearly with the number of cores. I have about 100mb of memory that could be shared between processes, but everything else would really need to be duplicated. As I said, Apache used to run on Windows with multiple processes; using a version that supports that is one option. There are good reasons not to do that, though, so you could be stuck with threads. I'm not sure it has done that since the 1.3 releases. mod_python will work for that, but involves going way back in it's release history as well. I really don't feel comfortable with that, and I don't doubt I'd give up a lot of things I'd miss. Having memory protection is superior to not having it--OS designers spent years implementing it, why would you toss out a fair chunk of it? Being explicit about what you're sharing is generally better than not. Actually, I agree. If shared memory will prove easier, then why not use it, if the application lends itself to that. But as I said, threads are a better solution if you're sharing the vast majority of your memory and have complex data structures to share. When you're starting a new project, really think about whether they're worth the considerable tradeoffs, though, and consider the merits of a multiprocess solution. There are merits, the GIL being one of those. I believe I can fairly easily rework things into a multi-process environment by duplicating memory. Over time I can make the memory usage more efficient by sharing some data structures out, but that may not even be necessary. The biggest problem is learning my way around Linux servers. I don't think I'll choose that option initially, but I may work on it as a project in the future. It's about time I got more familiar with Linux anyway. It's almost certainly not worth rewriting a large established codebase. Lazy me is in perfect agreement. I disagree with this, though. The benefits of deterministic GC are huge and I'd like to see ref-counting semantics as part of the language definition. That's a debate I just had in another thread, though, and don't want to repeat. I just took it for granted that a GC like Java and .NET use is better. I'll dig up that thread and have a look at it. I didn't say that. It can be a big hit or it can be unnoticeable. It depends on your application. You have to benchmark to know for sure. But if you're trying to make a guess: if you're doing a lot of heavy lifting in native modules then the GIL may be released during those calls, and you might get good multithreading performance. If you're doing lots of I/O requests the GIL is generally released during those and things will be fine. If you're doing lots of heavy crunching in Python, the GIL is probably held and can be a big performance issue. I don't do a lot of work in native modules, other than the standard library things I use, which doesn't count as heavy lifting. However I do a fair amount of database calls, and either the GIL is released by MySQLdb, or I'll contribute a patch so that it is. At any rate, I will measure, and I suspect the GIL will not be an issue. -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: Add NTLM proxy authentication to urllib2
looping napisał(a): I have to make internet connections through an ISA proxy server that use NTLM or Kerberos authorization method. I've found a program in python called ntlmaps that act like a proxy and could make the NTLM authentication, but you have to run it and make all your connection through it, not an optimal solution. So what I really need is an enhanced urllib2 that support NTLM or Kerberos. I've found that pywin32 could manage NTLM encryption with the sspi module but I've no idea how to implement it in urllib2, NTLM authentication use a 'Token dance' between client and server. Anyone has an experience, a demo or an idea to share ? Look at NTLM APS (http://ntlmaps.sourceforge.net/), Dimitry did this already (although not in urllib). -- Jarek Zgoda http://jpa.berlios.de/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting text into the copy-paste buffer...
David Hirschfield wrote: Strange request, but is there any way to get text into the linux copy-paste buffer from a python script ? I know the standard python libraries won't have that functionality (except as a side-effect, perhaps?), but is there a simple trick that would do it on linux? A command line to get text into the buffer? Using a gui toolkit as a proxy to get text in there? There's a utility called xclip that you can wrap with popen2 or something similar. I use my own proctools: import proctools XCLIP = proctools.which(xclip) es, arg = proctools.getstatusoutput(%s -o -selection primary % (XCLIP,)) arg has the X selection. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it just me, or is Sqlite3 goofy?
[EMAIL PROTECTED] wrote: I think your whole experience is based on it. But shouldn't a significant feature like that be explained in the Python manuals? Why should I go dig up Sqlite FAQs to learn what should have been in the manuals? I don't know, but I will take a stab at a plausible explanation. First, sqlite support has only been in Python for a month or three. Its first official unveiling will be when 2.5 is released. Although possibly too late for the final release, now would be a good time to straighten out the documentation. Second, it's common when wrapping functionality into Python to rely on the documentation for the thing being wrapped. The thinner the wrapper, the more you tend to rely on the underlying documentation. Also, the more functionally rich the thing you've wrapped, the more you rely on the underlying documentation. I wouldn't be at all surprised if the pysqlite author operated under that assumption. Ok, that's certainly plausible. But it's not an excuse. The thinner the documentation, the greater the emphasis should be made to point the reader to a more adequate source. Simply listing the Sqlite home page at the bottom of the page is hardly good enough. It should be explicitly stated in bold letters that the reader should go read the Sqlite FAQ because it radically differs from *real* databases and provide a seperate link to it in the body of the documentation. That the Python developers didn't pick up on the issue is not surprising. I'm not sure how many of them are (py)sqlite users, probably relatively few. I would be surprised if they had never used ANY database. A little thing like dynamic field typing will simply make it impossible to migrate your Sqlite data to a *real* database. What I'll do is re-format my rant, suggest how *I* would do the documentation, fix the errors I found in the examples and send it off to the Python bug tracking as suggested in the manuals. How's that as a plan? Skip -- http://mail.python.org/mailman/listinfo/python-list
Looking for CGI program to browse/manage/process files thru the web
Hello, I am looking for Python code no other language wanted) that I couls use/reuse/adapt to implement (via CGI, no specific app server wanted) a web-based app that would offer the following functionality: - browse a file hierarchy perhaps dealing with access rights check - classical file management operations like viewing downloading and perhaps renaming or deleting or copying... - but above all I want to esaily add custom operations that can be applied to browsable files for example, easily add a button that would apply a filter (perhaps user-parametrable) against the file and would display the output, adding another button to run such or such other file processing treatment... - security/coherency checks, as e.g. asserting that a processed file has such or such characteristics before even attempting to process it It would be nice for me to start with existing code that would constitute a clean and simple base that I could customize. I'd like to avoid coding another HTML+forms+etc generator... + this should be open source. Any advice? -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
[EMAIL PROTECTED] writes: It was removed at one point in the dim, dark past (circa Python 1.4) on an experimental basis. Aside from the huge amount of work, it resulted in significantly lower performance for single-threaded apps (that is, the common case). That's probably because they had to put locking and unlocking around every access to a reference count. A real GC might have fixed that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is it just me, or is Sqlite3 goofy?
What I'll do is re-format my rant, suggest how *I* would do the documentation, fix the errors I found in the examples and send it off to the Python bug tracking as suggested in the manuals. How's that as a plan? That's fine. Reformat your rant as a documentation bug report on SourceForge: http://sourceforge.net/projects/python If you mention specific sqlite documentation urls you think should be referenced in the pysqlite docs it would make it easier to accept. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Better way to replace/remove characters in a list of strings.
Hi Wouldn't this only cause problems with large lists - for once off scripts with small lists it doesn't seem like a big issue to me. Regards, Chris Bruno Desthuilliers wrote: Chris Brat a écrit : Thanks, thats exactly what I was looking for - very neat. Just note that both solutions rebind the name to a newly constructed list instead of modifying the original list in place. This is usually the RightThing(tm), but sometimes one wants an in-place modification. -- http://mail.python.org/mailman/listinfo/python-list
[ANN] IronPython 1.0 released today!
I'm extremely happy to announce that we have released IronPython 1.0 today! http://www.codeplex.com/IronPython I started work on IronPython almost 3 years ago. My initial motivation for the project was to understand all of the reports that I read on the web claiming that the Common Language Runtime (CLR) was a terrible platform for Python and other dynamic languages. I was surprised to read these reports because I knew that the JVM was an acceptable platform for these languages. About 9 years ago I'd built an implementation of Python that ran on the JVM originally called JPython and later shortened to Jython. This implementation ran a little slower than the native C-based implementation of Python (CPython), but it was easily fast enough and stable enough for production use - testified to by the large number of Java projects that incorporate Jython today. I wanted to understand how Microsoft could have screwed up so badly that the CLR was a worse platform for dynamic languages than the JVM. My plan was to take a couple of weeks to build a prototype implementation of Python on the CLR and then to use that work to write a short pithy article called, Why the CLR is a terrible platform for dynamic languages. My plans quickly changed as I worked on the prototype, because I found that Python could run extremely well on the CLR - in many cases noticeably faster than the C-based implementation. For the standard pystone benchmark, IronPython on the CLR was about 1.7x faster than the C-based implementation. The more time I spent working on IronPython and with the CLR, the more excited I became about its potential to finally deliver on the vision of a single common platform for a broad range of languages. At that same time, I was invited to come out to Microsoft to present IronPython and to talk with members of the CLR team about technical issues that I was running into. I had a great time that day working through these issues with a group of really smart people who all had a deep understanding of virtual machines and language implementation. After much reflection, I decided to join the CLR team at Microsoft where I could work with the platform to make it an even better target for dynamic languages and be able to have interesting technical discussions like that every day. The first few months at Microsoft were a challenge as I learned what was involved in working at a large company. However, once the initial hurdle was over I started experiencing the things that motivated me to come here in the first place. The team working on dynamic languages in general and IronPython in particular began to grow and I got to have those great technical discussions again about both how to make IronPython as good as it could be and how to make the CLR an even better platform. We began to take advantage of the great new features for dynamic languages already shipping in .NET 2.0 such as DynamicMethods, blindingly fast delegates and a new generics system that was seamlessly integrated with the existing reflection infrastructure. We were also able to release IronPython publicly from Microsoft with a BSD-style license. In the agile spirit of the project, we put out a new release of IronPython once every three weeks (on average) over the course of the project. This helped us connect well with our daring early adopters and receive and incorporate their feedback to make IronPython better. We've had countless excellent discussions on the mailing list on everything from supporting value types to calling overloaded methods. Without the drive and input of our users, IronPython would be a much weaker project. IronPython is about bringing together two worlds. The key value in IronPython is that it is both a true implementation of Python and is seamlessly integrated with the .NET platform. Most features were easy and natural choices where the language and the platform fit together with almost no work. However, there were challenges from the obvious cases like exception type hierarchies to the somewhat esoteric challenges concerning different methods on strings. We spent long days and sometimes weeks looking for the best answers to these challenging problems and in the end I think that we have stayed true to both Python and .NET. To drive our Python compatibility, we run a large portion of the standard Python regression test suite in addition to a large custom test suite we added that runs IronPython and CPython side-by-side to test for identical behavior whenever possible. Despite all of this work, there will still be differences between IronPython 1.0 and CPython. The most obvious difference is that IronPython is missing a number of standard C-based extension modules so things like import bsddb will fail. We maintain a detailed list of differences between the two implementations and aim to reduce the size of this list in every release. IronPython has also
Re: Getting text into the copy-paste buffer...
This is good info...but I'm looking for the opposite direction: I want to place some arbitrary command output text into the clipboard, not get the current selection out of the clipboard. Any help on that end? -Dave kdart wrote: David Hirschfield wrote: Strange request, but is there any way to get text into the linux copy-paste buffer from a python script ? I know the standard python libraries won't have that functionality (except as a side-effect, perhaps?), but is there a simple trick that would do it on linux? A command line to get text into the buffer? Using a gui toolkit as a proxy to get text in there? There's a utility called xclip that you can wrap with popen2 or something similar. I use my own proctools: import proctools XCLIP = proctools.which("xclip") es, arg = proctools.getstatusoutput("%s -o -selection primary" % (XCLIP,)) "arg" has the X selection. -- Presenting: mediocre nebula. -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting text into the copy-paste buffer...
Ah, indeed it does...my distro didn't have it, but a quick download and compile and there it is. Thanks a bunch, -Dave Keith Dart wrote: On 9/5/06, David Hirschfield [EMAIL PROTECTED] wrote: This is good info...but I'm looking for the opposite direction: I want to place some arbitrary command output text into the clipboard, not get the current selection out of the clipboard. Any help on that end? -Dave Oh, the same command works that direction also. Just use different command line options. Your distro may already have it. Just install it and check it out. -- -- - Keith Dart [EMAIL PROTECTED] == -- Presenting: mediocre nebula. -- http://mail.python.org/mailman/listinfo/python-list
Removing from a List in Place
I'm going to assume that it's supposed to work like this, but could someone tell me the reasoning behind it? I.E. why is 3 skipped? alist=[1,2,3] for item in alist: ... print item ... if item==2: ... alist.remove(item) ... 1 2 Bonus Question: Can we make this behave more intuitiviely in Python 3000? -Greg -- Gregory Piñero Chief Innovation Officer Blended Technologies (www.blendedtechnologies.com) -- http://mail.python.org/mailman/listinfo/python-list
Re: threading support in python
On 05 Sep 2006 13:19:03 -0700, Paul Rubin http://phr.cx@nospam.invalid wrote: [EMAIL PROTECTED] writes: It was removed at one point in the dim, dark past (circa Python 1.4) on an experimental basis. Aside from the huge amount of work, it resulted in significantly lower performance for single-threaded apps (that is, the common case). That's probably because they had to put locking and unlocking around every access to a reference count. A real GC might have fixed that. It would have made a difference, surely. Whether that difference would have been positive, negative, or unnoticable is a matter for benchmarking and profiling. Even if you eliminate reference counting, you still have memory allocation to deal with. Python allocates approximately a jillion objects every time you sneeze, and each of these goes through CPython's allocator, which needs a lock to protect it from being corrupted by concurrent invocations. It's not a simple matter to make CPython free-threaded (even so simple as replacing all reference counting with another form of garbage collection), although perhaps if half as much time were spent cutting code as is spent discussing the matter, we might learn if there were any value in doing so. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: [IronPython] [ANN] IronPython 1.0 released today!
Congratulations, Jim! Truly and amazing vision you and your development staff have brought into fruition :)From my recent post to the O'Reilly Windows DevCenter,ref: http://www.oreillynet.com/windows/blog/2006/09/jim_huguninmsft_announce_ironp.html Congratulations are in order to Jim Hugunin, Dino Viehland, Microsoft, the core IronPython development team, and two all of the community members that have been involved in the development of such a remarkable product which is represented by the final release of IronPython 1.0.To each of you listed above and to everyone involved with making this happen, a HUGE thank you! Truly an amazing accomplishment. On 9/5/06, Jim Hugunin [EMAIL PROTECTED] wrote: I'm extremely happy to announce that we have released IronPython 1.0 today! http://www.codeplex.com/IronPythonI started work on IronPython almost 3 years ago.My initial motivation for the project was to understand all of the reports that I read on the web claiming that the Common Language Runtime (CLR) was a terrible platform for Python and other dynamic languages.I was surprised to read these reports because I knew that the JVM was an acceptable platform for these languages.About 9 years ago I'd built an implementation of Python that ran on the JVM originally called JPython and later shortened to Jython.This implementation ran a little slower than the native C-based implementation of Python (CPython), but it was easily fast enough and stable enough for production use - testified to by the large number of Java projects that incorporate Jython today. I wanted to understand how Microsoft could have screwed up so badly that the CLR was a worse platform for dynamic languages than the JVM.My plan was to take a couple of weeks to build a prototype implementation of Python on the CLR and then to use that work to write a short pithy article called, Why the CLR is a terrible platform for dynamic languages.My plans quickly changed as I worked on the prototype, because I found that Python could run extremely well on the CLR - in many cases noticeably faster than the C-based implementation.For the standard pystone benchmark, IronPython on the CLR was about 1.7x faster than the C-based implementation.The more time I spent working on IronPython and with the CLR, the more excited I became about its potential to finally deliver on the vision of a single common platform for a broad range of languages.At that same time, I was invited to come out to Microsoft to present IronPython and to talk with members of the CLR team about technical issues that I was running into.I had a great time that day working through these issues with a group of really smart people who all had a deep understanding of virtual machines and language implementation.After much reflection, I decided to join the CLR team at Microsoft where I could work with the platform to make it an even better target for dynamic languages and be able to have interesting technical discussions like that every day. The first few months at Microsoft were a challenge as I learned what was involved in working at a large company.However, once the initial hurdle was over I started experiencing the things that motivated me to come here in the first place.The team working on dynamic languages in general and IronPython in particular began to grow and I got to have those great technical discussions again about both how to make IronPython as good as it could be and how to make the CLR an even better platform.We began to take advantage of the great new features for dynamic languages already shipping in .NET 2.0 such as DynamicMethods, blindingly fast delegates and a new generics system that was seamlessly integrated with the existing reflection infrastructure.We were also able to release IronPython publicly from Microsoft with a BSD-style license.In the agile spirit of the project, we put out a new release of IronPython once every three weeks (on average) over the course of the project.This helped us connect well with our daring early adopters and receive and incorporate their feedback to make IronPython better.We've had countless excellent discussions on the mailing list on everything from supporting value types to calling overloaded methods.Without the drive and input of our users, IronPython would be a much weaker project. IronPython is about bringing together two worlds.The key value in IronPython is that it is both a true implementation of Python and is seamlessly integrated with the .NET platform.Most features were easy and natural choices where the language and the platform fit together with almost no work.However, there were challenges from the obvious cases like exception type hierarchies to the somewhat esoteric challenges concerning different methods on strings. We spent long days and sometimes weeks looking for the best answers to these challenging problems and in the end I think that we have stayed true to both Python and .NET. To drive our Python compatibility, we run a large
Re: Removing from a List in Place
On 05/09/06, Gregory Piñero [EMAIL PROTECTED] wrote: I'm going to assume that it's supposed to work like this, but could someone tell me the reasoning behind it? I.E. why is 3 skipped? alist=[1,2,3] for item in alist: print item if item==2: alist.remove(item) 1 2 Bonus Question: Can we make this behave more intuitiviely in Python 3000? It does already, you just haven't grasped list fully yet :):) when you remove 2 from alist, the list becomes length 2, there is no longer a 3rd item in the list to iterate over. Try this alist=[1 ,2 ,3, 4] for item in alist: print item if item==2: alist.remove(item) print alist -- http://mail.python.org/mailman/listinfo/python-list
Re: Removing from a List in Place
On 05/09/06, Tim Williams [EMAIL PROTECTED] wrote: On 05/09/06, Gregory Piñero [EMAIL PROTECTED] wrote: I'm going to assume that it's supposed to work like this, but could someone tell me the reasoning behind it? I.E. why is 3 skipped? alist=[1,2,3] for item in alist: print item if item==2: alist.remove(item) 1 2 Bonus Question: Can we make this behave more intuitiviely in Python 3000? It does already, you just haven't grasped list fully yet :):) when you remove 2 from alist, the list becomes length 2, there is no longer a 3rd item in the list to iterate over. Try this alist=[1 ,2 ,3, 4] for item in alist: print item if item==2: alist.remove(item) print alist sorry, I meant to offer an alternative also in yourgiven case you can iterate over a copy of the list like this: for item in alist[:] : -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] IronPython 1.0 released today!
Félicitations. Et chapeau pour votre travail. Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list