A new french book on Python
Hello, A new french book is coming out on the 16th of august. It's focused on Python good practices, agility, and all the things that makes a Python developer loves the language. If you are interested, the web page is here : http://programmation-python.org/guide Regards Tarek -- http://mail.python.org/mailman/listinfo/python-list
Similarities between two modules
Hello, I am looking for some python library that would help me to find similarities between two modules of Python code. I am already playing with the levensthein distance but I am looking for some tool that would play with the tree code with stronger tests. Any hint ? (or even a recipe) regards Tarek Ziadé -- http://mail.python.org/mailman/listinfo/python-list
Re: portable way of locating an executable (like which)
On 9/21/12 1:59 AM, Nobody wrote: On Thu, 20 Sep 2012 23:06:46 +0200, Gelonida N wrote: I'd like to implement the equivalent functionality of the unix command /usr/bin/which The function should work under Linux and under windows. Note that "which" attempts to emulate the behaviour of execvp() etc. The exec(3) manpage will explain the precise algorithm used (e.g. they skip files for which the process lacks execute permission). Also, note that the shell has built-in commands, functions, and aliases in addition to programs. The "type" built-in command performs a similar function to "which" but using the shell's semantics. On some systems, the default configuration may alias "which" to "type". On Windows, there's a host of different "execute program" interface, all with subtly different semantics: which extensions they will run, which extensions can be omitted, which paths are used (e.g. %PATH%, paths from the registry, current directory). You can also look at shutil.which http://hg.python.org/cpython/file/aa153b827d17/Lib/shutil.py#l974 Mmmm I wonder why it's removed in the last revs.. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Development mode"
On 9/20/12 9:02 PM, py_lrnr wrote: I am new to python and I have come across the following command and its description: Now to be able to run the project you will need to install it and its >dependencies. python setup.py develop I looked up what the 'develop' argument does and found: Extra commands: develop install package in 'development mode' I searched for a description of 'development mode' but could not find a good description. Can anyone (very briefly) explain to me, in a sentence or two: what 'development mode' is? how 'development mode' differs from other 'modes'? why/when I would use 'development mode'? what 'development mode' does or does not allow me to do? Many thanks in advance. This a setuptools / distribute feature that allows you to add a project to your Python environment without installing it - so you can continue its "development" In other words, when you call "python setup.py develop", setuptools will compile the metadata and hook your project into Python's site-package, but the packages and modules that will be used are the one in the directory where you've run that command. This is useful to continue working on your code and testing it without having to run "python setup.py install" on every run see http://packages.python.org/distribute/setuptools.html#develop-deploy-the-project-source-in-development-mode -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On 9/21/12 12:07 PM, xliiv wrote: Like the topic.. . I found this: http://learnpythonthehardway.org/book/ex46.html it seems fine, but shouldn't be an interactive (with CLI API) script creating that? It's a lot of effort for common work. I can contribute but i have to know that i'm not reinvent a wheel. Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On 9/21/12 2:14 PM, xliiv wrote: Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example It's a nice beast but: - it's not built in. Should it be? I think it should. You can suggest this to python-ideas but I really doubt you will get any traction. The sdtlib don't get new features these days because it's a burden to maintain high level tool on a 2 years release cycle - about readme and manifest.in: "You could add to your template a file called readme.rst . Inside of it you can add the following code that will generate this:" i dont want to add, i want it already added :).. readme is something typical, it's not rare habit for some geeks how wants to customize it all!! the same with manifest.in.. what do you think? iteractive creation is big plus.. I am not sure I get your remark on this. I pointed to this page to show a typical use case of building Paster Templates, so you can bootstrap your projects boiler-plate code So IOW everyone's free to create any kind of template :) Cheers Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
On 9/21/12 10:20 PM, gengyang...@gmail.com wrote: Hello , I am currently using Python 3.2.3 . WHen I use the print function by typing print "Game Over" , it mentions " SyntaxError : invalid syntax ". Any ideas on what the problem is and how to resolve it ? Thanks a lot . print was a statement in python 2.x, it is now a function so you need parenthesis: >>> print("Game Over") Game Over GengYang -- http://mail.python.org/mailman/listinfo/python-list
Re: Fastest web framework
On 9/23/12 11:19 AM, Andriy Kornatskyy wrote: I have run recently a benchmark of a trivial 'hello world' application for various python web frameworks (bottle, django, flask, pyramid, web.py, wheezy.web) hosted in uWSGI/cpython2.7 and gunicorn/pypy1.9... you might find it interesting: http://mindref.blogspot.com/2012/09/python-fastest-web-framework.html Comments or suggestions are welcome. Thanks. Andriy Kornatskyy I would try this with a web app that does more than 'Hello World' You may argue that you're just trying the server stack, but that's not realistic because you don't really measure how the server behaves with a real app. Have a look at https://github.com/mozilla-services/chaussette/blob/master/chaussette/util.py#L188 (setup_bench and teardow_bench have to be run on startup and tear down of the server) I would be curious to see how things goes then Cheers Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: Fastest web framework
On 9/25/12 3:21 PM, Andriy Kornatskyy wrote: Tarek, With all respect, running benchmark on something that has sleeps, etc is pretty far from real world use case. So I went a little bit different way. That's not a good summary of what the function does. It does not just sleep. It does some I/O and CPU bound tasks. The sleep is here to simulate a blocking I/O call, besides the DB calls. The whole function tries to simulate a real application, unlike printing 'Hello World' - to put the stack under realistic conditions. The multiplication is cached by the processor, but will still push some CPU work on every call. Here is a live demo (a semi real world web application) that comes with wheezy.web framework as a template: http://wheezy.pythonanywhere.com/ I have implemented it in a way that it uses one web framework (wheezy.web) and various template engines (jinja2, mako, tenjin, wheezy.template and wheezy.template with preprocessor)... Please see the following post under `Real World Example` section: http://mindref.blogspot.com/2012/07/python-fastest-template.html Source code here: https://bitbucket.org/akorn/wheezy.web/src/tip/demos/template The real world example shows the difference between template engines implementing the same things. The same applies to web frameworks (more or less depending on your choice). Thanks. Great, thanks for the update ! -- that's cool to bench the template engines, but this is still not what I had in mind. What I had in mind was to try each one of the framework with an application that does things, and see how the whole stack reacts on high load. But I guess we have different goals - wheezy seems really fast, congrats. Cheers Tarek Andriy Date: Mon, 24 Sep 2012 13:50:31 +0200 From: ta...@ziade.org To: python-list@python.org Subject: Re: Fastest web framework On 9/23/12 11:19 AM, Andriy Kornatskyy wrote: I have run recently a benchmark of a trivial 'hello world' application for various python web frameworks (bottle, django, flask, pyramid, web.py, wheezy.web) hosted in uWSGI/cpython2.7 and gunicorn/pypy1.9... you might find it interesting: http://mindref.blogspot.com/2012/09/python-fastest-web-framework.html Comments or suggestions are welcome. Thanks. Andriy Kornatskyy I would try this with a web app that does more than 'Hello World' You may argue that you're just trying the server stack, but that's not realistic because you don't really measure how the server behaves with a real app. Have a look at https://github.com/mozilla-services/chaussette/blob/master/chaussette/util.py#L188 (setup_bench and teardow_bench have to be run on startup and tear down of the server) I would be curious to see how things goes then Cheers Tarek -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Fastest web framework
On 9/26/12 11:26 AM, Andriy Kornatskyy wrote: Tarek, Thank you for the response back. Yes, your idea is pretty clear to me. The point is that higher workload you put in your application business logic, repository, backend, whatever... less you will see in final results comparison. This is obvious and we, as technical people, very well understand this (somebody even laugh). I am happy somebody got a good laugh, I had a myself a good coffee :) The reality is that not all web applications do heavy CPU computations and/or experience IO delays (due to response from database running a query over table that has no index, let say), some use caches, some split jobs to be run in background, some parallel them... I have to state that simple things must perform really fast to give more room for one that are not so. That in turn makes your infrastructure more effective. Some prefer to add a box, some see that a likely to be a problem further it goes. The good thing - you have a choice, you are not locked, and as result you are responsible for the effectiveness of the system you build today and definitely next one. Take care. Andriy You are not getting my point. What happens to weezhy or XXX framework when you are running it in a given stack, under heavy load ? There are many interactions that may impact the behavior of the stack - most of them are in the web server itself, but they can be things in the framework too, depending on the architectural choice. And you will not know it with an hello world app. To put it more bluntly, your benchmark is going to join the big pile of hello worlds benchmarks that are completely meaningless. If you want to prove that weezhy is faster than another py framework, because, I dunno, the number of function calls are smaller ? then you need to isolate this and do a different kind of bench. Have a look at http://plope.com/pyroptimization , it's a good example Same thing for the raw speed of your templating engine - isolation is required. One good read: http://blog.ianbicking.org/2010/03/16/web-server-benchmarking-we-need/ Cheers Tarek Date: Wed, 26 Sep 2012 11:08:19 +0200 From: ta...@ziade.org To: andriy.kornats...@live.com CC: python-list@python.org Subject: Re: Fastest web framework On 9/25/12 3:21 PM, Andriy Kornatskyy wrote: Tarek, With all respect, running benchmark on something that has sleeps, etc is pretty far from real world use case. So I went a little bit different way. That's not a good summary of what the function does. It does not just sleep. It does some I/O and CPU bound tasks. The sleep is here to simulate a blocking I/O call, besides the DB calls. The whole function tries to simulate a real application, unlike printing 'Hello World' - to put the stack under realistic conditions. The multiplication is cached by the processor, but will still push some CPU work on every call. Here is a live demo (a semi real world web application) that comes with wheezy.web framework as a template: http://wheezy.pythonanywhere.com/ I have implemented it in a way that it uses one web framework (wheezy.web) and various template engines (jinja2, mako, tenjin, wheezy.template and wheezy.template with preprocessor)... Please see the following post under `Real World Example` section: http://mindref.blogspot.com/2012/07/python-fastest-template.html Source code here: https://bitbucket.org/akorn/wheezy.web/src/tip/demos/template The real world example shows the difference between template engines implementing the same things. The same applies to web frameworks (more or less depending on your choice). Thanks. Great, thanks for the update ! -- that's cool to bench the template engines, but this is still not what I had in mind. What I had in mind was to try each one of the framework with an application that does things, and see how the whole stack reacts on high load. But I guess we have different goals - wheezy seems really fast, congrats. Cheers Tarek Andriy Date: Mon, 24 Sep 2012 13:50:31 +0200 From: ta...@ziade.org To: python-list@python.org Subject: Re: Fastest web framework On 9/23/12 11:19 AM, Andriy Kornatskyy wrote: I have run recently a benchmark of a trivial 'hello world' application for various python web frameworks (bottle, django, flask, pyramid, web.py, wheezy.web) hosted in uWSGI/cpython2.7 and gunicorn/pypy1.9... you might find it interesting: http://mindref.blogspot.com/2012/09/python-fastest-web-framework.html Comments or suggestions are welcome. Thanks. Andriy Kornatskyy I would try this with a web app that does more than 'Hello World' You may argue that you're just trying the server stack, but that's not realistic because you don't really measure how the server behaves with a real app. Have a look at https://github.com/mozilla-services/chau
Re: section with in a section config file and reading that config file
On 10/19/12 11:51 AM, kampy wrote: hi all, my requirement is to have section with in a section in config parameters ex: [AAA] [BBB] a=1 b=1 [CCC] a=1 b=2 Any one help me in understanding how to make sure that config file to have a structure like this and reading with the config parser a configuration file is a flat sequences of sections, you cannot do this what you could do is have 2 files, and add a link from one to the other: file1.ini: [AAA] extended = file2.ini file2.ini: [BBB] a=1 b=1 [CCC] a=1 b=2 then create a bit of logic on the top of ConfigParser to read back those values HTH Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: section with in a section config file and reading that config file
On 10/19/12 12:22 PM, narasimha1...@gmail.com wrote: yes but it is not only for one structure like above there will be many sections like that I'd use yaml or json then... -- http://mail.python.org/mailman/listinfo/python-list
Re: section with in a section config file and reading that config file
On 10/19/12 11:29 PM, Steven D'Aprano wrote: On Fri, 19 Oct 2012 12:09:53 +0200, Tarek Ziadé wrote: On 10/19/12 11:51 AM, kampy wrote: hi all, my requirement is to have section with in a section in config parameters ex: [AAA] [BBB] a=1 b=1 [CCC] a=1 b=2 Any one help me in understanding how to make sure that config file to have a structure like this and reading with the config parser a configuration file is a flat sequences of sections, you cannot do this That is incorrect. uh ? A configuration file is a file containing configuration data. That is all. yeah, organized in [sections]. a flat list of sections. "Configuration file" says nothing about the format of the file. It could be a Unix .rc file, a Windows .ini file with no section header, a Windows .ini file with section headers, a Python source code file, YAML, JSON, XML, a PLIST file, or any other format you decide to use. If the Original Poster wants an ini file with nested sections, he can have an ini file with nested sections. That's not an ini file anymore. That's a Foord-file :) There's no notion of nested sections in ini configuration files, since there's no syntax marker to do the nesting see https://en.wikipedia.org/wiki/INI_file#Sections There is no support for nested sections in the ConfigParser module, but the ConfigObj third-party module supports it. Otherwise the OP could write his own code, possibly by subclassing from ConfigParser. This is not a ini configuration file anymore, since it introduces ad-hoc markers added that are not recognized by other parsers. Which is fine. But instead of using an exotic, ad-hoc, look-alike ini file, I strongly recommend using a standard that has native nested elements (json or yaml) Cheers Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal about naming conventions around packaging
On 5/30/12 6:59 PM, Benoît Bryon wrote: Hi, Hi Benoit you should post this to the distutils SIG Thank you Here is a proposal about naming conventions around packaging. Main question is: would you accept it as a PEP? Preliminary notes (not part of the proposal) Before I start, here are some preliminary notes about the context... * Situation * * first posted to distutils-sig list: http://mail.python.org/pipermail/distutils-sig/2012-May/018551.html * then opened a ticket on CPython issue tracker: http://bugs.python.org/issue14899 * started to work in a fork... https://bitbucket.org/benoitbryon/cpython/src/doc-package-names/Doc/packaging/packagenames.rst * ... but this looks like a PEP. So, let's follow PEP 1 and post a proposal here. *** What follows is a draft *** * First of all, I promise I did my best ;) * I guess most points already have been discussed here or elsewhere. But since I couldn't find an official reference (i.e. a refused PEP), I believe consensus is possible. * I splitted proposals in small sections, so that people can discuss or refuse some items while accepting others. If you see something that is not atomic, please propose a split. * I tried to relate facts. But I feel like a newbie about some points, so, if you see something wrong or incomplete, please send information and/or sources. * I tried to propose actions and take existing projects into account. In my humble opinion, motivations and proposals below seem reasonable enough. That's why I am posting here to get feedback from the community. * Finally, I am not a native english speaker... feel free to improve vocabulary, grammar and so on :) That said, let's go... .. note:: You can also get the following proposal online at https://bitbucket.org/benoitbryon/cpython/src/doc-package-names/Doc/packaging/packagenames.rst Thanks to Martin Aspeli for his article. Thanks to early reviewers: Alexis Métaireau, Éric Bréhault, Jean-Philippe Camguilhem and Mathieu Leplâtre. Regards, Benoit ### Names in packaging: conventions and recipes ### This document deals with: * names of Python projects, * names of distributions in projects, * names of Python packages or modules being distributed, * namespace packages. It provides conventions and recipes for distribution authors. Main use case is: * as a developer, I want to create a project in order to distribute a package. So I have to choose names. Which names are "good"? * `The Zen of Python`_ says: In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. * So I need clear and official (i.e. obvious) guidelines or conventions that I can follow. * Here are conventions, guidelines and recipes. Guidelines for existing projects are also given. *** Terminology *** First of all, let's make sure there is no confusion... Distribution name Distribution name is used by packaging utilities: * in :doc:`setup script`, it is the value passed as ``name`` to ``packaging.core.setup()`` * it appears on `PyPI`_ if the package is registered on it * it can be used in `pip` requirements files * it can be used in `buildout` configuration files. Distribution term is introduced in :doc:`packaging docs`. Egg name It is the same concept as distribution name. Technically, the egg is not the distribution. But they use the same name: it is declared as ``packaging.core.setup()`` name argument. "Egg" term is the legacy counterpart to "distribution". It was used by distutils and setuptools. It becomes deprecated with the new packaging module. This document focuses on distributions, not eggs. Package and module names Package and module names are used in Python code. It is the string used in :ref:`import statements`. Remember that, from a file system perspective, packages are directories and modules are files. :ref:`Python packaging allows distributions to distribute several packages and/or modules`. Project name Usually the name of the repository or folder in which distribution authors put their code. It generally is the directory name of the "distribution root", as defined in :ref:`packaging-term`. Namespace packages It is common practice to use namespaces in package names. `PEP 420`_ brings this concept to core Python. When PEP 420 will be accepted, Python officially supports namespace packages. As an example, consider `django-debug-toolbar`_: * ``django-debug-toolbar`` is the distribution name. `It is declared in setup.py file
network protocols
Hey I was surprised not to find any way to list all protocol names listed in /etc/protocols in Python We have socket.getprotobyname(NAME) But there's no way to get the list of names Any ideas if this is available in the stdlib somehwere ? Thx Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: network protocols
On 6/13/12 8:33 PM, Christian Heimes wrote: Am 13.06.2012 16:56, schrieb Christian Heimes: Am 13.06.2012 13:41, schrieb Tarek Ziadé: Hey I was surprised not to find any way to list all protocol names listed in /etc/protocols in Python We have socket.getprotobyname(NAME) But there's no way to get the list of names Any ideas if this is available in the stdlib somehwere ? No, I can't find any reference to the relevant NSS APIs in the Python code. You can easily roll your own with ctypes: PS: You can also parse the output of "getent protocols". As for all name services you shouldn't parse the file as other sources (ldap, dns, nis, databases) can provide additional information. See man nsswitch.conf Christian Thanks for the pointers -- I was going to open('etc/protocols').readlines() :) -- http://mail.python.org/mailman/listinfo/python-list
Python with Oracle Database Course.
I have created Python with Oracle Database Course, and offer 50% discount till 10-5-2016. Any one interested in course just click on below link. https://www.udemy.com/using-python-with-oracle-db/? Then write coupon Code=PYTHON_ORACLE_50%25 -- https://mail.python.org/mailman/listinfo/python-list
Memory stats
Hi list, I am trying to find a general memory profiler that can measure the memory usage in Python program and gather some stats about object usages, and things like that. I am trying to find a simple python module to be able to customize it and integrates it to other tools i have. (it should exists i guess) Thanks, Tarek -- Tarek Ziadé, Nuxeo R&D (Paris, France) CPS Platform : http://www.cps-project.org Zope3 / ECM : http://www.z3lab.org mail: tziade at nuxeo.com; tel: +33 (0) 6 30 37 02 63 -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory stats
Martin v. Löwis wrote: >Tarek Ziadé wrote: > > >>I am trying to find a general memory profiler that can measure the >>memory usage in Python program >>and gather some stats about object usages, and things like that. >> >> > >As Diez says, use gc: gc.getobjects() gives you all container objects. >If you want a list of all objects (container or not), you have to >compile a debug build of Python. > >Regards, >Martin > > Ok thanks, I am amazed not to find an existing implementation for this. Regards Tarek -- Tarek Ziadé, Nuxeo R&D (Paris, France) CPS Platform : http://www.cps-project.org Zope3 / ECM : http://www.z3lab.org mail: tziade at nuxeo.com; tel: +33 (0) 6 30 37 02 63 -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory stats
gene tani wrote: >linux: >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222 > > Yes thanks I have found this one, I need to try it out, but it does not provide a way to refcount, Another solution could be to use trace maybe I am going to try things out Regards -- http://mail.python.org/mailman/listinfo/python-list
portable way to get process infos
Hi, I am getting infos on the current process, under linux, by reading the file pointed by: '/proc/%d/status' % os.getpid() huh :( There's probably another way to do it on win32 but, i was wondering if there's a way or an existing extension out there to do make it work on any platform. Regards, Tarek -- http://mail.python.org/mailman/listinfo/python-list
machine-independant bench
Hi list, I am trying to code some utilities to bench code performances, machine-independant, to be able to measure the absolute cost of a piece of code. So i came up with the pystone idea (i've been told too in fact ;)). so I just run pystones on the test machines and use it as a ratio over code performance measurement. This is pretty good, but the major caveat is that if the CPU is busy , it can be slower than expected. So i've introduced a tolerance flag, (another approach than the three times run like hotshot does). Any comment ? Any alternatives to pystone in mind ? Tarek -- Tarek Ziadé | Nuxeo R&D (Paris, France) CPS Plateform : http://www.cps-project.org mail: tziade at nuxeo.com | tel: +33 (0) 6 30 37 02 63 You need Zope 3 - http://www.z3lab.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't want to serialize a variable of object
Iyer, Prasad C wrote: >Hi, >I got a class which I need to serialize, except for couple of variable. >i.e. > >import cPickle as p >class Color: >def __init__(self): >print "hello world" >self.x=10 >self.somechar="this are the characters" >color=Color() >f=file('poem.txt', 'w') >p.dump(color, f) >f.close() > >How do I serialize the object color without serializing the x and >somechar variables? >Is there any modifier which prevents the variable from being serialized. > > You can create your own serialization process, by providing some kind of serialize() method in a base class that would dump part of the object. Let's say, the instance __dict__ dictionnary ? this serialize method can then remove the attributes that starts with '_v_' (that's what we do in Zope to avoid pickling some attribute) > > > >Another question: > Is there a concept of private variables? > > That's a long discussion, you should look at the archives in the list. But anyway, all attributes that starts with '__' are considered private to the class. (ie: can't be reached by "instance.__attribute") even though you can find it if you dig into instance.__dict__ Regards, Tarek -- http://mail.python.org/mailman/listinfo/python-list
ssl and timeout issue
Hello, I cannot manage to use socket timeouts with an imap ssl connector,and i badly *need* it :'( I have already mentionned it here: http://archives.free.net.ph/message/20050620.151244.e5390efe.en.html Does anyone have a solution ? (I thought of coding my own threaded timer over the ssl socket, but...) Tarek Traceback: >>> from imaplib import IMAP4_SSL, IMAP4_SSL_PORT >>> import socket >>> test = IMAP4_SSL('mail..com', 993) >>> test.sock.settimeout(10) >>> test.login('[EMAIL PROTECTED]', 'password') Traceback (most recent call last): File "", line 1, *in* ? File "/usr/lib/python2.4/imaplib.py", line 480, *in* login typ, dat = self._simple_command('LOGIN', user, self._quote(password)) File "/usr/lib/python2.4/imaplib.py", line 1028, *in* _simple_command *return* self._command_complete(name, self._command(name, *args)) File "/usr/lib/python2.4/imaplib.py", line 858, *in* _command_complete typ, data = self._get_tagged_response(tag) File "/usr/lib/python2.4/imaplib.py", line 959, *in* _get_tagged_response self._get_response() File "/usr/lib/python2.4/imaplib.py", line 876, *in* _get_response resp = self._get_line() File "/usr/lib/python2.4/imaplib.py", line 969, *in* _get_line line = self.readline() File "/usr/lib/python2.4/imaplib.py", line 1135, *in* readline char = self.sslobj.read(1) socket.sslerror: The read operation timed out >>> test = IMAP4_SSL('mail..com', 993) >>> test.login('[EMAIL PROTECTED]', 'password') ('OK', ['LOGIN Ok.']) -- Tarek Ziadé | Nuxeo R&D (Paris, France) CPS Plateform : http://www.cps-project.org mail: tziade at nuxeo.com | tel: +33 (0) 6 30 37 02 63 You need Zope 3 - http://www.z3lab.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: "Daemonizing" an application.
On 2/27/13 11:52 AM, Gilles Lenfant wrote: Hello, Sorry for the obscure title, but I can't make short to explain what I'm searching for. :) I made an app (kind of proxy) that works without UI within it's process. So far, so good. Now I need to change "live" some controls of this application, without stopping it. So my app will be split in two : * A control app (say "appctl") for a console UI * A daemon (or agent ?) that runs the core of the app (say "appd"), processing inputs and outputs What are the best practices to do this ? Examples in a well known Pyhon app I could hack ? Is it possible with standard packages only ? Thanks in advance fo any pointer. You can have a look at Circus - https://circus.readthedocs.org which is a process manager. "circusctl" is used to control "circusd" using ZeroMQ The nice thing about zmq as opposed to signals is that you can code your thing independantly from the transport then choose which transport fits a situation: TPC (then the ctl can be on another box), IPC or even ITC That also means your ctl part can be portable to any platform Cheers Tarek -- Tarek Ziadé · http://ziade.org · @tarek_ziade -- http://mail.python.org/mailman/listinfo/python-list
Re: "Daemonizing" an application.
s/TPC/TCP ;) -- http://mail.python.org/mailman/listinfo/python-list
rexec and Python 2.5
HelloI tried to use rexec in Python 2.5, since i've seen that the module was still presentBut it fails, and this code can be found in rexec.RExec init code:raise RuntimeError, "This code is not secure in Python 2.2 and 2.3"So, the comment should talk about 2.4 and 2.5 too ? Is this just a forgotten change ? If so, why it is still deployed in Python ?I want to embed a Python read-eval-print loop in one of my python program, so if someone has another way to do it RegardsTarek-- Tarek Ziadé | Association AfPy | www.afpy.orgSite personnel | http://programmation-python.org -- http://mail.python.org/mailman/listinfo/python-list
Re: A Call to Arms for Python Advocacy
On 12/7/06, Jeff Rush <[EMAIL PROTECTED]> wrote: [snip] These works are to be formed into advocacy kits for various audiences. So far we have the following ideas for kits: - College Student's Python Advocacy Kit - IT Department Python Advocacy Kit - University Educator's Python Advocacy Kit - K-12 Educator's Python Advocacy Kit - Research Lab Python Advocacy Kit The table of contents for the various kits can be found at: http://wiki.python.org/moin/Advocacy#AdvocacyKits Did we miss your kit? And what would you include in any of these? perhaps a local python user group advocacy kit ? a PSF kit that would help LUGs to spread the good word, or some kind of support for LUGs creation also, I think we could have a european store for shirts , like the caffepress one, to lower the prices for european people and the deliver time. because in europe most Python developers won't pay 30$ for a simple shirt, that comes 3 weeks later Next, we are seeking reusable/retargetable teaching materials, such as those under a Creative Commons license. We need slide presentations and class handouts. Now I know there are a great many slide presentations on the web about Python. I can google them all but we're not looking for just any presentation, we're looking for the best of field. You can find the collection point at: http://wiki.python.org/moin/Advocacy#TeachingMaterials Last, perhaps you can dash off an idea or two for promotional merchandise. This could be the usuals like shirts but also posters, bumper stickers and buttons. What would you like to have? And with what graphics or slogans? We can reuse some of the slogans from the PyCon Slogan Contest, but are there others? Our collection point for promo item ideas is at: http://wiki.python.org/moin/Advocacy/WearablesGadgets All materials will be credited to the authors to the extent possible by the delivery media. Make your mark. Jeff Rush <[EMAIL PROTECTED]> Python Advocacy Coordinator -- http://mail.python.org/mailman/listinfo/python-list -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/ -- http://mail.python.org/mailman/listinfo/python-list
python, zlib, and fedora 64bits
Hello, I am trying to compile Python on a Fedora 64bits, and I can't make zlib work. a python setup.py build leads to : ... building 'zlib' extension gcc -pthread -shared build/temp.linux-x86_64-2.4/usr/local/src/Python-2.4.4/Modules/zlibmodule.o -L/opt/python-2.4.4/lib -L/usr/local/lib -lz -o build/lib.linux-x86_64-2.4 /zlib.so /usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libz.a: could not read symbols: Bad value collect2: ld gab 1 als Ende-Status zurück running build_scripts running install_lib ... I've tried to recompile zlib, but didn't find any way to avoid this error any ideas ? Otherwise, does anyone has a zlib.so for fedora 64bits to send me ? Thx Tarek -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: python, zlib, and fedora 64bits
On 1/6/07, Tarek Ziadé <[EMAIL PROTECTED]> wrote: I am answering to myself, if it can help someone else. zlib has to be recompiled with CFLAGS set to -fPIC. So before launching ./configure do a: export CFLAGS="-fPIC" Python then will build properly zlib.so Tarek -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: python, zlib, and fedora 64bits
I am answering to myself, if it can help someone else. zlib has to be recompiled with CFLAGS set to -fPIC. So before launching ./configure do a: export CFLAGS="-fPIC" Python then will build properly zlib.so Tarek -- http://mail.python.org/mailman/listinfo/python-list
A new French Python Book
Hello, I would like to annouce here a new book for French Python programmers: "Programmation Python" at Eyrolle's It contains, beside a syntax review and a presentation of builtins and some modules from the standard library -- yes nothing very new here, but my prompt examples are very funny--, chapters about test-driven development, object-oriented patterns and best practices. My book is for people who already know how to write programs, no matter the language. and want to learn Python, or for Python beginners. The book contains a lot of hidden jokes so you should get it English speaking programmers should get it too: it's a very pleasant way to learn french. Enough marketing. -> More infos on its dedicated website: http://programmation-python.org Best regards, Tarek Ziadé -- Tarek Ziadé | Association AfPy | www.afpy.orgSite personnel | http://programmation-python.org -- http://mail.python.org/mailman/listinfo/python-list
stop a doctest execution
Hello, is there a simple way to stop a doctest execution within its code ? my use case is to abort the execution of part of the doc, given an arbitrary condition. That could be: existence of a third party package or whatever. Adding tests throughout the doctest does not look good. Maybe it's time to implement the 'exit' builtin ? ;) Failed example: exit Expected nothing Got: 'Use Ctrl-D (i.e. EOF) to exit.' Tarek-- Tarek Ziadé | Association AfPy | www.afpy.orgSite personnel | http://programmation-python.org -- http://mail.python.org/mailman/listinfo/python-list
TypeError: ssl() argument 1 must be _socket.socket, not _socketobject -> Solution
Hi, by googling for a ssl socket problem, i've seen you guys had the same problem ie : http://mail.python.org/pipermail/python-list/2005-April/278179.html I have found the problem : If you trace a little bit and look at __module__ attribute of the socket, you will probably find out socket has been patched but the timeout mechanism, provided by the old timeoutsocket.py module provided by Timothy O'Malley timeoutsocket module is pretty *strong* since it catches all sockets in your code, even thaught you did'nt ask for it, imo this is evil Latests Python have integrated timeout mechanism in sockets so you should remove all timeoutsocket.py you have in your paths Regards Tarek -- Tarek ZIADE, Nuxeo SARL: Zope Service Provider. Mail: [EMAIL PROTECTED] - Tel: +33 (0)6 30 37 02 63 Nuxeo Collaborative Portal Server: http://www.nuxeo.com/cps Gestion de contenu web / portail collaboratif / groupware / open source -- http://mail.python.org/mailman/listinfo/python-list
ssl issues with socket timeout
Hello, anyone knows a way to deal with this problem ? http://sourceforge.net/tracker/index.php?func=detail&aid=1153016&group_id=5470&atid=105470 This bug has been fixed in 2.3 but there is a regression in 2.4 Tarek -- Tarek ZIADE, Nuxeo SARL: Zope Service Provider. Mail: [EMAIL PROTECTED] - Tel: +33 (0)6 30 37 02 63 Nuxeo Collaborative Portal Server: http://www.nuxeo.com/cps Gestion de contenu web / portail collaboratif / groupware / open source -- http://mail.python.org/mailman/listinfo/python-list
IMAP Proxy
Hi, I want to write a small TCP Server in Python to make an IMAP Proxy for post-processing client requests. It is not long either complicated but needs to be very robust so... maybe someone here has already done such a thing I can use or know where i can get it ? Cheers, Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: International Python user groups events calendar
Hi, we have one to add: the french speaking python days http://journees.afpy.org/ 2/3 June - Paris - France Regards On 19 Apr 2007 18:43:23 -0700, TechVenue Eventmaster <[EMAIL PROTECTED]> wrote: FYI All, International Python user groups events calendar: http://TechVenue.com/Calendars/Python/ Enjoy! TechVenue.com Eventmasters -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/ -- http://mail.python.org/mailman/listinfo/python-list
can you help me
hello please, I have this error, error C1083 Cannot open include file BaseTsd.h, invalide argument, I installed the platformSDK , but the same error , can you help me __ Do You Yahoo!? En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités http://mail.yahoo.fr Yahoo! Mail -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] Global Python Sprint Weekends: May 10th-11th and June 21st-22nd.
On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord <[EMAIL PROTECTED]> wrote: > Trent Nelson wrote: > > Following on from the success of previous sprint/bugfix weekends and > > sprinting efforts at PyCon 2008, I'd like to propose the next two > > Global Python Sprint Weekends take place on the following dates: > > > > * May 10th-11th (four days after 2.6a3 and 3.0a5 are released) > > * June 21st-22nd (~week before 2.6b2 and 3.0b2 are released) > > > > It seems there are a few of the Python User Groups keen on meeting > > up in person and sprinting collaboratively, akin to PyCon, which I > > highly recommend. I'd like to nominate Saturday across the board > > as the day for PUGs to meet up in person, with Sunday geared more > > towards an online collaboration day via IRC, where we can take care > > of all the little things that got in our way of coding on Saturday > > (like finalising/preparing/reviewing patches, updating tracker and > > documentation, writing tests ;-). > > > > For User Groups that are planning on meeting up to collaborate, > > please reply to this thread on [EMAIL PROTECTED] and let every- > > one know your intentions! > > > > > > I should be able to help organise and attend the London contribution. > Personally I'd like to work on the documentation changes / clean-up for > the unittest module discussed recently. We are trying to set up a team here in Paris, Personnally I would like to continue the work started in distutils (various patches) and some friends here are interested in contributing on documentation. Tarek -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/ -- http://mail.python.org/mailman/listinfo/python-list
Pyrhon2.5 to 2.4 conversion
Hi, I am currently using oauth2.py library, and it works fine on one of my PC's (python2.5), but later on when I tried to use it with python2.4 the following line (line 332 in http://github.com/simplegeo/python-oauth2/blob/master/oauth2/__init__.py) showed a syntax error items = [(k, v if type(v) != ListType else sorted(v)) for k,v in sorted(self.items()) if k != 'oauth_signature'] So it there a way to convert this line to a python2.4 compliant syntax. Thanks a lot, Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyrhon2.5 to 2.4 conversion
Thanks a lot everybody for your help, it worked now :) On Feb 28, 4:12 am, MRAB wrote: > tarek...@gmail.com wrote: > > Hi, > > > I am currently using oauth2.py library, and it works fine on one of my > > PC's (python2.5), but later on when I tried to use it with python2.4 > > the following line (line 332 > > inhttp://github.com/simplegeo/python-oauth2/blob/master/oauth2/__init__.py) > > showed a syntax error > > > items = [(k, v if type(v) != ListType else sorted(v)) for k,v in > > sorted(self.items()) if k != 'oauth_signature'] > > > So it there a way to convert this line to a python2.4 compliant > > syntax. > > I think the clearest is: > > items = [] > for k, v in sorted(self.items()): > if k != 'oauth_signature': > if type(v) == ListType: > v = sorted(v) > items.append((k, v)) -- http://mail.python.org/mailman/listinfo/python-list
PEP 376
Hello, I would like to propose this PEP for inclusion into Python 2.7 / 3.2 http://www.python.org/dev/peps/pep-0376/ It has been discussed a lot already in the distutils-SIG, but new feedbacks are welcome there's an implementation prototype here : http://bitbucket.org/tarek/pep376/src/tip/pkgutil.py Regards Tarek -- Tarek Ziadé | http://ziade.org -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 376
On Wed, Jul 1, 2009 at 12:52 AM, Carl Banks wrote: > On Jun 30, 12:41 pm, Tarek Ziadé wrote: >> Hello, >> >> I would like to propose this PEP for inclusion into Python 2.7 / 3.2 >> >> http://www.python.org/dev/peps/pep-0376/ >> >> It has been discussed a lot already in the distutils-SIG, but new >> feedbacks are welcome >> >> there's an implementation prototype here >> :http://bitbucket.org/tarek/pep376/src/tip/pkgutil.py > > +1 > > This seems to be a well-designed solution that corrects the ad-hoc- > ness of installation while keeping its effects on existing tools > small. > > I hate those egg-info files but I would be very happy if they'd at > least always be in an accounted-for place. Maybe I'd even consider > making use of them some day. > > As for setuptools, I'm sure it will accommodate the change and > probably improve itself in the process. (And if the setuptools > doesn't change then some other tool will grow into its niche; either > way it'd be an improvement.) > Yes exactly, the plan is to try to make distutils a reference layer for third party package managers and if possible to become a "smaller" package later on the road. Cheers Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 376
2009/7/2 Joachim Strömbergson : > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Aloha! > > Richard Brodie wrote: >> "Joachim Str�mbergson" wrote in message >> news:mailman.2422.1246418400.8015.python-l...@python.org... >> >>> Even so, choosing md5 in 2009 for something that (hopefully) will be >>> used in years is a bad design decision. It creates a dependency for to >>> an algorithm that all sensible recommendations point you to move away >>> from. >> >> Why not write the field as algorithm:value? >> >> e.g. sha1:8590b685654367e3eba70dc00df7e45e88c21da4 >> >> Installers can fallback to using hashlib.new(), so you can plug in a new >> algorithm without changing the PEP or the installer code. > > +1 > > Good idea and future proof as well as being simple. The prefix is a good idea but since it's just a checksum to control that the file hasn't changed what's wrong with using a weak hash algorithm like md5 or now sha1 ? If someone wants to modify a file of a distribution he can recreate the checksum as well, the only secured way to prevent that would be to use gpg keys but isn't that overkill for what we need ? e.g. making sure a file wasn't modified when distutils uninstalls a distribution. Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 376
Ok here's my proposal for the checksum : - I'll add the "hash_type:" suffix in the record file - install will get a new option to define what hash should be used when writing the RECORD file it will default to SHA1 for 2.7/3.2 - pkgutil, that reads the RECORD files, will pick the right hash function by looking at the suffix now for the security it's another story that goes beyond the scope of this PEP notice though, that the PEP provides a place-holder for distributions metadata, so it could host a key later on. On Thu, Jul 2, 2009 at 8:00 PM, Charles Yeomans wrote: > > On Jul 2, 2009, at 1:37 PM, Lie Ryan wrote: > >> Joachim Strömbergson wrote: >>> >>> Aloha! >>> >>> Tarek Ziadé wrote: >>>> >>>> The prefix is a good idea but since it's just a checksum to control >>>> that the file hasn't changed >>>> what's wrong with using a weak hash algorithm like md5 or now sha1 ? >>> >>> Because it creates a dependency to an old algorithm that should be >>> deprecated. Also using MD5, even for a thing like this might make people >>> belive that it is an ok algorithm to use - "Hey, it is used by the >>> default install in Python, so it must be ok, right?" >>> >>> If we flip the argument around: Why would you want to use MD5 instead of >>> SHA-256? For the specific use case the performance will not (should not) >>> be an issue. >>> >>> As I wrote a few mails ago, it is time to move forward from MD5 and >>> designing something in 2009 that will be around for many years that uses >>> MD5 is (IMHO) a bad design decision. >>> >>>> If someone wants to modify a file of a distribution he can recreate >>>> the checksum as well, >>>> the only secured way to prevent that would be to use gpg keys but >>>> isn't that overkill for what we need ? >>> >>> Actually, adding this type of security would IMHO be a good idea. >>> >> >> Now, are we actually talking about security or checksum? >> >> It has been known for years that MD5 is weak, weak, weak. Not just in >> the recent years. But it doesn't matter since MD5 was never designed for >> security, MD5 was designed to protect against random bits corruption. If >> you want security, look at least to GPG. For data protection against >> intentional, malicious forging, definitely MD5 is the wrong choice. But >> when you just want a simple checksum to ensure that a faulty router >> somewhere in the internet backbone doesn't destroying your data, MD5 is >> a fine algorithm. >> -- > > On the contrary, MD5 was intended to be a cryptographic hash function, not a > checksum. > > Charles Yeomans > > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tarek Ziadé | http://ziade.org -- http://mail.python.org/mailman/listinfo/python-list