ANN: pyftpdlib 1.1.0 released
Hi there guys, I'm pleased to announce pyftpdlib 1.1.0. This is mainly a bugfix release, see: https://pyftpdlib.googlecode.com/svn/trunk/HISTORY === Links === Home: http://code.google.com/p/pyftpdlib/ Download: https://pyftpdlib.googlecode.com/files/pyftpdlib-1.1.0.tar.gz Tutorial: http://code.google.com/p/pyftpdlib/wiki/Tutorial Enjoy, Giampaolo -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil 0.7.0 released
Hi there folks, I'm pleased to announce the 0.7.0 release of psutil: http://code.google.com/p/psutil/ This is mainly a bugfix release addressing a couple of high priority issues on Linux and FreeBSD. Complete list of bugfixes and enhancements is here: https://psutil.googlecode.com/hg/HISTORY === New features === - psutil.get_boot_time() - get/set process IO priority on Windows - psutil.cpu_times() on Linux now includes new 'steal', 'guest' and guest_nice' fields available on recent kernels - psutil.cpu_times_percent() which provides utilization percentages for each specific CPU time as is returned by cpu_times() - source code has been migrated from SVN to Mercurial === Compatitility notes === - Process cmdline and ppid properties are no longer cached after first access - psutil.error module is deprecated and scheduled for removal === Links === - Home: http://code.google.com/p/psutil - Sources: http://psutil.googlecode.com/files/psutil-0.7.0.tar.gz - Docs: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil 0.7.0 released
Hi there folks, I'm pleased to announce the 0.7.0 release of psutil: http://code.google.com/p/psutil/ This is mainly a bugfix release addressing a couple of high priority issues on Linux and FreeBSD. Complete list of bugfixes and enhancements is here: https://psutil.googlecode.com/hg/HISTORY === New features === - psutil.get_boot_time() - get/set process IO priority on Windows - psutil.cpu_times() on Linux now includes new 'steal', 'guest' and guest_nice' fields available on recent kernels - psutil.cpu_times_percent() which provides utilization percentages for each specific CPU time as is returned by cpu_times() - source code has been migrated from SVN to Mercurial === Compatitility notes === - Process cmdline and ppid properties are no longer cached after first access - psutil.error module is deprecated and scheduled for removal === Links === - Home: http://code.google.com/p/psutil - Sources: http://psutil.googlecode.com/files/psutil-0.7.0.tar.gz - Docs: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
ANN: pyftpdlib 1.0.0 released
Hi there guys, After 1 year of development and refinements I'm pleased to announce a release of pyftpdlib which appears to be the fastest FTP server out there (on UNIX at least)! See: http://code.google.com/p/pyftpdlib/wiki/Benchmarks 1.0.0 release introduces serious improvements amongst which python 3 support (finally!) and full Unicode support. Here's the major ones. === New IO loop and epoll() / kqueue() support === The IO loop, originally relying on asyncore, has been rewritten from scratch (http://code.google.com/p/pyftpdlib/source/browse/trunk/pyftpdlib/ioloop.py) and now supports epoll() on Linux and kqueue() on OSX/BSD. Also select() (Windows) and poll() pollers have been rewritten resulting in pyftpdlib being an order of magnitude faster and more scalable than ever. Read the full story here: http://code.google.com/p/pyftpdlib/issues/detail?id=203 === Alternative concurrency model === It is now possible to change the default concurrency model from async (non blocking) to multiple processes / threads based, meaning you are now free to block as long as you want and support particularly slow filesystems. Switching is as easy as changing an import. More information are here: http://code.google.com/p/pyftpdlib/wiki/Tutorial#4.6_-_Changing_the_concurrency_model === Python 3 porting + full Unicode support === Finally! === Logging === logging module is now used for logging as replacement for log(), logline() and logerror() functions which are now deprecated. Also, the whole logging infrastructure has been refactored and it is more compact and consistent. Also by default pyftpdlib logs will have colors. === Other improvements === * a new FilesystemError exception class is available in order send custom error strings to client from an AbstracteFS subclass. * on_connect() and on_disconnect() callbacks * FTPHandler.ftp_* methods implementing filesystem-related commands now return a meaningful value on success (tipically the path name). * FTPServer.serve_forever() has a new handle_exit parameter which can be set to False in order to avoid handling SIGTERM/SIGINT signals. === Backward compatibility breakage === A lot of backward incompatible changes have been introduced amongst which the different import system, the different validate_authentication() signature and the fact that the filesystem class now expects Unicode strings rather than bytes. HISTORY file enlists all of them and also provides a guide on how to port your existent to this new version. http://code.google.com/p/pyftpdlib/source/browse/trunk/HISTORY?spec=svn1175r=1172#85 === Some links === Home: http://code.google.com/p/pyftpdlib/ Download: http://code.google.com/p/pyftpdlib/list/downloads Tutorial: http://code.google.com/p/pyftpdlib/wiki/Tutorial Complete list of changes: http://code.google.com/p/pyftpdlib/source/browse/trunk/HISTORY That should be all folks. I hope you'll enjoy this new version, Giampaolo Rodola' -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: pyftpdlib 1.0.0 released
Hi there guys, After 1 year of development and refinements I'm pleased to announce a release of pyftpdlib which appears to be the fastest FTP server out there (on UNIX at least)! See: http://code.google.com/p/pyftpdlib/wiki/Benchmarks 1.0.0 release introduces serious improvements amongst which python 3 support (finally!) and full Unicode support. Here's the major ones. === New IO loop and epoll() / kqueue() support === The IO loop, originally relying on asyncore, has been rewritten from scratch (http://code.google.com/p/pyftpdlib/source/browse/trunk/pyftpdlib/ioloop.py) and now supports epoll() on Linux and kqueue() on OSX/BSD. Also select() (Windows) and poll() pollers have been rewritten resulting in pyftpdlib being an order of magnitude faster and more scalable than ever. Read the full story here: http://code.google.com/p/pyftpdlib/issues/detail?id=203 === Alternative concurrency model === It is now possible to change the default concurrency model from async (non blocking) to multiple processes / threads based, meaning you are now free to block as long as you want and support particularly slow filesystems. Switching is as easy as changing an import. More information are here: http://code.google.com/p/pyftpdlib/wiki/Tutorial#4.6_-_Changing_the_concurrency_model === Python 3 porting + full Unicode support === Finally! === Logging === logging module is now used for logging as replacement for log(), logline() and logerror() functions which are now deprecated. Also, the whole logging infrastructure has been refactored and it is more compact and consistent. Also by default pyftpdlib logs will have colors. === Other improvements === * a new FilesystemError exception class is available in order send custom error strings to client from an AbstracteFS subclass. * on_connect() and on_disconnect() callbacks * FTPHandler.ftp_* methods implementing filesystem-related commands now return a meaningful value on success (tipically the path name). * FTPServer.serve_forever() has a new handle_exit parameter which can be set to False in order to avoid handling SIGTERM/SIGINT signals. === Backward compatibility breakage === A lot of backward incompatible changes have been introduced amongst which the different import system, the different validate_authentication() signature and the fact that the filesystem class now expects Unicode strings rather than bytes. HISTORY file enlists all of them and also provides a guide on how to port your existent to this new version. http://code.google.com/p/pyftpdlib/source/browse/trunk/HISTORY?spec=svn1175r=1172#85 === Some links === Home: http://code.google.com/p/pyftpdlib/ Download: http://code.google.com/p/pyftpdlib/list/downloads Tutorial: http://code.google.com/p/pyftpdlib/wiki/Tutorial Complete list of changes: http://code.google.com/p/pyftpdlib/source/browse/trunk/HISTORY That should be all folks. I hope you'll enjoy this new version, Giampaolo Rodola' -- http://mail.python.org/mailman/listinfo/python-list
ANN: psutil 0.6.0 released
Hi folks, I'm pleased to announce the 0.6.0 release of psutil: http://code.google.com/p/psutil/ This is one of the best releases so far as it addresses two important issues: system memory functions management and permission errors occurring on Windows and OSX. === Memory functions === psutil.phymem_usage() and psutil.virtmem_usage() are deprecated. Instead we now have psutil.virtual_memory() and psutil.swap_memory(), which should provide all the necessary pieces to monitor the actual system memory usage, both physical and swap/disk related. The refactoring was modeled after Zabbix, see: http://code.google.com/p/psutil/issues/detail?id=311 http://blog.zabbix.com/when-alexei-isnt-looking/#vm.memory.size http://www.zabbix.com/documentation/2.0/manual/appendix/items/vm.memory.size_params If you don't want to read how and why I did that, the bottom line is: if you want to monitor actual system memory usage in a cross platform fashion use: psutil.virtual_memory().available === No more AccessDenied exceptions when querying processes === On Windows and OSX the Process methods below were always raising AccessDenied for any process owned by another user: OSX - name - get_memory_info() - get_memory_percent() - get_cpu_times() - get_cpu_percent() - get_num_threads() WINDOWS - create_time - get_children() - get_cpu_times() - get_cpu_percent() - get_memory_info() - get_memory_percent() - get_num_handles() - get_io_counters() Especially on OSX this made psutil basically unusable as a limited user, even for determining basic process information such as CPU percent or memory usage. Now this is no longer the case. For further details see: http://code.google.com/p/psutil/issues/detail?id=297 http://code.google.com/p/psutil/issues/detail?id=303 === Other major enhancements === - per-process extended memory stats. - per-process number of voluntary and involuntary context switches. - per-process connections: added UNIX sockets support. - (BSD) Process.get_connections() rewritten in C and no longer requiring lsof. - (OSX) added support for process cwd - psutil.network_io_counters() now provides the number of in/out packets dropped and with errors. - new example scripts: example/meminfo.py example/free.py example/netstat.py example/pmap.py === New features by example === import psutil, os p = psutil.Process(os.getpid()) p.get_num_ctx_switches() amount(voluntary=78, involuntary=19) p.get_ext_memory_info() meminfo(rss=9662464, vms=49192960, shared=3612672, text=2564096, lib=0, data=5754880, dirty=0) p.get_connections(kind='unix') [connection(fd=8, family=1, type=1, local_address='/tmp/unix_socket.sock', remote_address=None, status='')] psutil.virtual_memory() vmem(total=8374149120L, available=2081050624L, percent=75.1, used=8074080256L, free=300068864L, active=3294920704, inactive=1361616896, buffers=529895424L, cached=1251086336) psutil.swap_memory() swap(total=2097147904L, used=296128512L, free=1801019392L, percent=14.1, sin=304193536, sout=677842944) === Compatitility notes === 0.6.0 version does not introduce any backward incompatibility. Nevertheless it introduces some deprecations warnings: - psutil.phymem_usage() is deprecated in favor of psutil.virtual_memory() - psutil.virmem_usage() is deprecated in favor of psutil.swap_memory() - psutil.cached_phymem() is deprecated in favor of psutil.virtual_memory().cached - psutil.phymem_buffers() is deprecated in favor of psutil.virtual_memory().buffers The deprecated functions will be removed in next 1.0.0 version. === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.6.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil 0.6.0 released
Hi folks, I'm pleased to announce the 0.6.0 release of psutil: http://code.google.com/p/psutil/ This is one of the best releases so far as it addresses two important issues: system memory functions management and permission errors occurring on Windows and OSX. === Memory functions === psutil.phymem_usage() and psutil.virtmem_usage() are deprecated. Instead we now have psutil.virtual_memory() and psutil.swap_memory(), which should provide all the necessary pieces to monitor the actual system memory usage, both physical and swap/disk related. The refactoring was modeled after Zabbix, see: http://code.google.com/p/psutil/issues/detail?id=311 http://blog.zabbix.com/when-alexei-isnt-looking/#vm.memory.size http://www.zabbix.com/documentation/2.0/manual/appendix/items/vm.memory.size_params If you don't want to read how and why I did that, the bottom line is: if you want to monitor actual system memory usage in a cross platform fashion use: psutil.virtual_memory().available === No more AccessDenied exceptions when querying processes === On Windows and OSX the Process methods below were always raising AccessDenied for any process owned by another user: OSX - name - get_memory_info() - get_memory_percent() - get_cpu_times() - get_cpu_percent() - get_num_threads() WINDOWS - create_time - get_children() - get_cpu_times() - get_cpu_percent() - get_memory_info() - get_memory_percent() - get_num_handles() - get_io_counters() Especially on OSX this made psutil basically unusable as a limited user, even for determining basic process information such as CPU percent or memory usage. Now this is no longer the case. For further details see: http://code.google.com/p/psutil/issues/detail?id=297 http://code.google.com/p/psutil/issues/detail?id=303 === Other major enhancements === - per-process extended memory stats. - per-process number of voluntary and involuntary context switches. - per-process connections: added UNIX sockets support. - (BSD) Process.get_connections() rewritten in C and no longer requiring lsof. - (OSX) added support for process cwd - psutil.network_io_counters() now provides the number of in/out packets dropped and with errors. - new example scripts: example/meminfo.py example/free.py example/netstat.py example/pmap.py === New features by example === import psutil, os p = psutil.Process(os.getpid()) p.get_num_ctx_switches() amount(voluntary=78, involuntary=19) p.get_ext_memory_info() meminfo(rss=9662464, vms=49192960, shared=3612672, text=2564096, lib=0, data=5754880, dirty=0) p.get_connections(kind='unix') [connection(fd=8, family=1, type=1, local_address='/tmp/unix_socket.sock', remote_address=None, status='')] psutil.virtual_memory() vmem(total=8374149120L, available=2081050624L, percent=75.1, used=8074080256L, free=300068864L, active=3294920704, inactive=1361616896, buffers=529895424L, cached=1251086336) psutil.swap_memory() swap(total=2097147904L, used=296128512L, free=1801019392L, percent=14.1, sin=304193536, sout=677842944) === Compatitility notes === 0.6.0 version does not introduce any backward incompatibility. Nevertheless it introduces some deprecations warnings: - psutil.phymem_usage() is deprecated in favor of psutil.virtual_memory() - psutil.virmem_usage() is deprecated in favor of psutil.swap_memory() - psutil.cached_phymem() is deprecated in favor of psutil.virtual_memory().cached - psutil.phymem_buffers() is deprecated in favor of psutil.virtual_memory().buffers The deprecated functions will be removed in next 1.0.0 version. === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.6.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: psutil 0.5.0 released
2012/6/27 Giampaolo Rodolà g.rod...@gmail.com: Hi folks, I'm pleased to announce the 0.5.0 release of psutil: http://code.google.com/p/psutil/ === Major new features === - system users - (Linux, Windows) process CPU affinity (get and set) - (POSIX) process number of opened file descriptors. - (Windows) process number of opened handles. - psutil.disk_partitions() now provides also mount options - new Process.as_dict() method. - Process.get_children(recursive=True): return all process descendants. - 2to3 is not longer required to run at installation time in order to support Python 3 - ppid, name, exe, cmdline and create_time properties of Process class are now cached after being accessed. - psutil.process_iter() now caches Process instances between calls. For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === New features by example === import psutil, os psutil.get_users() [user(name='giampaolo', terminal='pts/2', host='localhost', started=1340737536.0), user(name='giampaolo', terminal='pts/3', host='localhost', started=1340737792.0)] psutil.disk_partitions() [partition(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'), partition(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw')] p = psutil.Process(os.getpid()) p.get_num_fds() 4 p.get_num_handles() # windows only 254 p.get_memory_maps() [mmap(path='/lib/x86_64-linux-gnu/libutil-2.15.so', rss=16384, anonymous=8192, swap=0), mmap(path='/lib/x86_64-linux-gnu/libc-2.15.so', rss=6384, anonymous=15, swap=0), mmap(path='/lib/x86_64-linux-gnu/libcrypto.so.1.0.0', rss=34124, anonymous=1245, swap=0), mmap(path='[heap]', rss=54653, anonymous=8192, swap=0), mmap(path='[stack]', rss=1542, anonymous=166, swap=0), ...] p.as_dict() {'status': 0, 'pid': 29510, 'connections': [], 'cmdline': ['python'], ...} p.get_cpu_affinity() [0, 1, 2, 3] p.set_cpu_affinity([0]) p.get_children(recursive=True) [Process..., Process..., ...] === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.5.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ A last-moment bug on Windows appeared. Please ignore 0.5.0 version and download 0.5.1: http://psutil.googlecode.com/files/psutil-0.5.1.tar.gz --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
ANN: psutil 0.5.0 released
Hi folks, I'm pleased to announce the 0.5.0 release of psutil: http://code.google.com/p/psutil/ === Major new features === - system users - (Linux, Windows) process CPU affinity (get and set) - (POSIX) process number of opened file descriptors. - (Windows) process number of opened handles. - psutil.disk_partitions() now provides also mount options - new Process.as_dict() method. - Process.get_children(recursive=True): return all process descendants. - 2to3 is not longer required to run at installation time in order to support Python 3 - ppid, name, exe, cmdline and create_time properties of Process class are now cached after being accessed. - psutil.process_iter() now caches Process instances between calls. For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === New features by example === import psutil, os psutil.get_users() [user(name='giampaolo', terminal='pts/2', host='localhost', started=1340737536.0), user(name='giampaolo', terminal='pts/3', host='localhost', started=1340737792.0)] psutil.disk_partitions() [partition(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'), partition(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw')] p = psutil.Process(os.getpid()) p.get_num_fds() 4 p.get_num_handles() # windows only 254 p.get_memory_maps() [mmap(path='/lib/x86_64-linux-gnu/libutil-2.15.so', rss=16384, anonymous=8192, swap=0), mmap(path='/lib/x86_64-linux-gnu/libc-2.15.so', rss=6384, anonymous=15, swap=0), mmap(path='/lib/x86_64-linux-gnu/libcrypto.so.1.0.0', rss=34124, anonymous=1245, swap=0), mmap(path='[heap]', rss=54653, anonymous=8192, swap=0), mmap(path='[stack]', rss=1542, anonymous=166, swap=0), ...] p.as_dict() {'status': 0, 'pid': 29510, 'connections': [], 'cmdline': ['python'], ...} p.get_cpu_affinity() [0, 1, 2, 3] p.set_cpu_affinity([0]) p.get_children(recursive=True) [Process..., Process..., ...] === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.5.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil 0.5.0 released
Hi folks, I'm pleased to announce the 0.5.0 release of psutil: http://code.google.com/p/psutil/ === Major new features === - system users - (Linux, Windows) process CPU affinity (get and set) - (POSIX) process number of opened file descriptors. - (Windows) process number of opened handles. - psutil.disk_partitions() now provides also mount options - new Process.as_dict() method. - Process.get_children(recursive=True): return all process descendants. - 2to3 is not longer required to run at installation time in order to support Python 3 - ppid, name, exe, cmdline and create_time properties of Process class are now cached after being accessed. - psutil.process_iter() now caches Process instances between calls. For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === New features by example === import psutil, os psutil.get_users() [user(name='giampaolo', terminal='pts/2', host='localhost', started=1340737536.0), user(name='giampaolo', terminal='pts/3', host='localhost', started=1340737792.0)] psutil.disk_partitions() [partition(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'), partition(device='/dev/sda2', mountpoint='/home', fstype='ext, opts='rw')] p = psutil.Process(os.getpid()) p.get_num_fds() 4 p.get_num_handles() # windows only 254 p.get_memory_maps() [mmap(path='/lib/x86_64-linux-gnu/libutil-2.15.so', rss=16384, anonymous=8192, swap=0), mmap(path='/lib/x86_64-linux-gnu/libc-2.15.so', rss=6384, anonymous=15, swap=0), mmap(path='/lib/x86_64-linux-gnu/libcrypto.so.1.0.0', rss=34124, anonymous=1245, swap=0), mmap(path='[heap]', rss=54653, anonymous=8192, swap=0), mmap(path='[stack]', rss=1542, anonymous=166, swap=0), ...] p.as_dict() {'status': 0, 'pid': 29510, 'connections': [], 'cmdline': ['python'], ...} p.get_cpu_affinity() [0, 1, 2, 3] p.set_cpu_affinity([0]) p.get_children(recursive=True) [Process..., Process..., ...] === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.5.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Advantages of logging vs. print()
Hi all, I'm currently working on 1.0.0 release of pyftpdlib module. This new release will introduce some backward incompatible changes in that certain APIs will no longer accept bytes but unicode. While I'm at it, as part of this breackage I was contemplating the possibility to rewrite my logging functions, which currently use the print statement, and use the logging module instead. As of right now pyftpdlib delegates the logging to 3 functions: def log(s): Log messages intended for the end user. print s def logline(s): Log commands and responses passing through the command channel. print s def logerror(s): Log traceback outputs occurring in case of errors. print sys.stderr, s The user willing to customize logs (e.g. write them to a file) is supposed to just overwrite these 3 functions as in: from pyftpdlib import ftpserver def log2file(s): ...open(''ftpd.log', 'a').write(s) ... ftpserver.log = ftpserver.logline = ftpserver.logerror = log2file Now I'm asking: what benefits would imply to get rid of this approach and use logging module instead? From a module vendor perspective, how exactly am I supposed to use/provide logging in my module? Am I supposed to do this: import logging logger = logging.getLogger(pyftpdlib) ...and state in my doc that logger is the object which is supposed to be used in case the user wants to customize how logs behave? Is logging substantially slower compared to print()? Thanks in advance --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Creating a Windows installer for Python + a set of dependencies
Hi all, I need to create an installer for Windows which should be able to install a specific version of the Python interpreter (2.7) plus a set a dependencies such as ipython, numpy, pandas, etc. Basically this is the same thing Active State did for their Active Python distribution: a single bundle including interpreter + deps. Not being a Windows user I'm not sure where to start with this except maybe looking into NSIS (could that be of any help?). Thanks in advance, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Listing children processes
Il 28 febbraio 2012 22:47, Arnaud Delobelle arno...@gmail.com ha scritto: On 28 February 2012 21:39, Mihai Badoiu mbad...@gmail.com wrote: On Tue, Feb 28, 2012 at 4:35 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Feb 28, 2012 at 10:33 AM, Mihai Badoiu mbad...@gmail.com wrote: I'm trying to compute the total CPU load of an external process and it's children. (so I cannot use resource.getrusage) For the load of the process I can just grab it from /proc/X/stat. How do I get the CPU load of the children processes? Is there an easy way to get a list of the children processes? http://code.google.com/p/psutil/ Cheers, Chris Looked at that before. psutil doesn't do children. Yes, it does: import psutil, os p = psutil.Process(os.getpid()) p.get_children() [ ... list of process children ... ] --- Giampaolo code.google.com/p/pyftpdlib/ code.google.com/p/psutil/ code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: asynchronous downloading
Il 24 febbraio 2012 02:10, Plumo richar...@gmail.com ha scritto: that example is excellent - best use of asynchat I have seen so far. I read through the python-dev archives and found the fundamental problem is no one maintains asnycore / asynchat. Well, actually I do/did. Point with asyncore/asynchat is that it's original design is so flawed and simplicistic it doesn't allow actual customization without breaking compatibility. See for example: http://bugs.python.org/issue6692 --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: asynchronous downloading
Il 23 febbraio 2012 07:58, Plumo richar...@gmail.com ha scritto: I want to download content asynchronously. This would be straightforward to do threaded or across processes, but difficult asynchronously so people seem to rely on external libraries (twisted / gevent / eventlet). (I would use gevent under different circumstances, but currently need to stick to standard libraries.) I looked around and found there is little interest in developing a proper HTTP client on asyncore. The best I found stopped development a decade ago: http://sourceforge.net/projects/asynchttp/ What do you recommend? And why is there poor support for asynchronous execution? Richard -- http://mail.python.org/mailman/listinfo/python-list If you want to stick with asyncore try to take a look at this: https://gist.github.com/151 And why is there poor support for asynchronous execution? I'd say that's true for stdlib only (asyncore/asynchat). There are plenty of choices amongst third party modules though. To say one, I particularly like tornado which is simple and powerful: http://www.tornadoweb.org/documentation/httpclient.html --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: [bug] imaplib case sensitive
Please file a bug on http://bugs.python.org/ --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ Il 21 febbraio 2012 10:31, Petite Abeille petite.abei...@gmail.com ha scritto: Hello, Looks like imaplib is case sensitive, even though the IMAP protocol isn't: (1) Except as noted otherwise, all alphabetic characters are case-insensitive. The use of upper or lower case characters to define token strings is for editorial clarity only. Implementations MUST accept these strings in a case-insensitive fashion. http://tools.ietf.org/html/rfc3501#section-9 For example: [Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) ] [imaplib 2.58] import imaplib M = imaplib.IMAP4( 'localhost', 1143 ) M.login( 'user', 'password' ) M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(ENVELOPE)') print 'Message %s\n%s\n' % (num, data[0][1]) M.close() M.logout() Traceback (most recent call last): File Test.py, line 3, in module M = imaplib.IMAP4( 'localhost', 1143 ) File python2.6/imaplib.py, line 184, in __init__ self.welcome = self._get_response() File python2.6/imaplib.py, line 935, in _get_response raise self.abort(unexpected response: '%s' % resp) imaplib.abort: unexpected response: '* ok imap4rev1' Note the 'ok' tag in lower case. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
ANN: pyftpdlib 0.7.0 released
Hi, I'm pleased to announce release 0.7.0 of Python FTP Server library (pyftpdlib). http://code.google.com/p/pyftpdlib/ === About === Python FTP server library provides an high-level portable interface to easily write asynchronous FTP/S servers with Python. pyftpdlib is currently the most complete RFC-959 FTP server implementation available for Python programming language. === sendfile() === sendfile(2) system call usage has finally been introduced. sendfile(2) provides a zero-copy way of copying data from one file descriptor to another (a socket). The phrase zero-copy refers to the fact that all of the copying of data between the two descriptors is done entirely by the kernel, with no copying of data into userspace buffers, resuting in file transfers (RETR, hence from server to client) being from 2x to 3x faster. A simple benchmark: pyftpdlib 0.6.0:693.41 MB/sec pyftpdlib 0.7.0: 1694.14 MB/sec proftpd 1.3.4rc2: 1313.77 MB/sec vsftpd 2.3.2: 1505.18 MB/sec In order to use sendfile(2) you'll have to install pysendfile module first (UNIX only): http://code.google.com/p/pysendfile/ === Faster scheduler === The internal scheduler, governed by CallLater and CallEvery classes, has been rewritten from scratch and it is an order of magnitue faster, especially for operations like cancel() which are involved when clients are disconnected (hence invoked very often). Some benchmarks: schedule: +0.5x reschedule: +1.7x cancel: +477x (with 1 milion scheduled functions) run: +8x Also, a single scheduled function now consumes 1/3 of the memory thanks to __slots__ usage. For further details see: http://code.google.com/p/pyftpdlib/issues/detail?id=189 === SITE CHMOD === This new version supports SITE CHMOD command, meaning the client is now able to change file mode bits by issuing SITE CHMOD path mode command. The authorizer now accepts a new M permission bit, which, when specified, enables SITE CHMOD usage: authorizer = DummyAuthorizer() authorizer.add_user('user', 'password', '/home/user', perm='elradfmwM') === Other improvements === * on_failed_login() callback: this is called when user provides wrong credentials. * CallEvery class: same as CallLater, but keeps calling a function every X seconds. * A benchmark script: http://code.google.com/p/pyftpdlib/source/browse/trunk/test/bench.py * Anti flood demo script: http://pyftpdlib.googlecode.com/svn/trunk/demo/anti_flood_ftpd.py A complete list of changes including enhancements and bug fixes is available here: http://code.google.com/p/pyftpdlib/wiki/ReleaseNotes07 === More links === * Source tarball: http://pyftpdlib.googlecode.com/files/pyftpdlib-0.7.0.tar.gz * Online docs: http://code.google.com/p/pyftpdlib/wiki/Tutorial * FAQs: http://code.google.com/p/pyftpdlib/wiki/FAQ * RFCs compliance paper: http://code.google.com/p/pyftpdlib/wiki/RFCsCompliance * Issue tracker: http://code.google.com/p/pyftpdlib/issues/list If you think pyftpdlib is worth a donation you can do so by going here: http://code.google.com/p/pyftpdlib/wiki/Donate Thanks, --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: pyftpdlib 0.7.0 released
Hi, I'm pleased to announce release 0.7.0 of Python FTP Server library (pyftpdlib). http://code.google.com/p/pyftpdlib/ === About === Python FTP server library provides an high-level portable interface to easily write asynchronous FTP/S servers with Python. pyftpdlib is currently the most complete RFC-959 FTP server implementation available for Python programming language. === sendfile() === sendfile(2) system call usage has finally been introduced. sendfile(2) provides a zero-copy way of copying data from one file descriptor to another (a socket). The phrase zero-copy refers to the fact that all of the copying of data between the two descriptors is done entirely by the kernel, with no copying of data into userspace buffers, resuting in file transfers (RETR, hence from server to client) being from 2x to 3x faster. A simple benchmark: pyftpdlib 0.6.0:693.41 MB/sec pyftpdlib 0.7.0: 1694.14 MB/sec proftpd 1.3.4rc2: 1313.77 MB/sec vsftpd 2.3.2: 1505.18 MB/sec In order to use sendfile(2) you'll have to install pysendfile module first (UNIX only): http://code.google.com/p/pysendfile/ === Faster scheduler === The internal scheduler, governed by CallLater and CallEvery classes, has been rewritten from scratch and it is an order of magnitue faster, especially for operations like cancel() which are involved when clients are disconnected (hence invoked very often). Some benchmarks: schedule: +0.5x reschedule: +1.7x cancel: +477x (with 1 milion scheduled functions) run: +8x Also, a single scheduled function now consumes 1/3 of the memory thanks to __slots__ usage. For further details see: http://code.google.com/p/pyftpdlib/issues/detail?id=189 === SITE CHMOD === This new version supports SITE CHMOD command, meaning the client is now able to change file mode bits by issuing SITE CHMOD path mode command. The authorizer now accepts a new M permission bit, which, when specified, enables SITE CHMOD usage: authorizer = DummyAuthorizer() authorizer.add_user('user', 'password', '/home/user', perm='elradfmwM') === Other improvements === * on_failed_login() callback: this is called when user provides wrong credentials. * CallEvery class: same as CallLater, but keeps calling a function every X seconds. * A benchmark script: http://code.google.com/p/pyftpdlib/source/browse/trunk/test/bench.py * Anti flood demo script: http://pyftpdlib.googlecode.com/svn/trunk/demo/anti_flood_ftpd.py A complete list of changes including enhancements and bug fixes is available here: http://code.google.com/p/pyftpdlib/wiki/ReleaseNotes07 === More links === * Source tarball: http://pyftpdlib.googlecode.com/files/pyftpdlib-0.7.0.tar.gz * Online docs: http://code.google.com/p/pyftpdlib/wiki/Tutorial * FAQs: http://code.google.com/p/pyftpdlib/wiki/FAQ * RFCs compliance paper: http://code.google.com/p/pyftpdlib/wiki/RFCsCompliance * Issue tracker: http://code.google.com/p/pyftpdlib/issues/list If you think pyftpdlib is worth a donation you can do so by going here: http://code.google.com/p/pyftpdlib/wiki/Donate Thanks, --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: while True or while 1
Il 21 gennaio 2012 22:13, Erik Max Francis m...@alcyone.com ha scritto: The real reason people still use the `while 1` construct, I would imagine, is just inertia or habit, rather than a conscious, defensive decision. If it's the latter, it's a case of being _way_ too defensive. It's also because while 1 is faster: import time t = time.time() x = 0 while 1: x += 1 if x 1000: break print(time.time() - t) while True: 1.41121292114 while 1: 1.07101011276 Most of the times tha't won't make any noticeable difference, but it's also true that certain while loops are going to iterate milions of times. Think about receiving a 10 GB file by using a socket. You'd tipically have something like this: while 1: chunk = sock.recv(1024): if not chunk: break ... Now, that's a case where I (personally) want to explicitly use while 1 instead of while True. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
Re: while True or while 1
Il 23 gennaio 2012 20:12, Erik Max Francis m...@alcyone.com ha scritto: Giampaolo Rodolà wrote: Il 21 gennaio 2012 22:13, Erik Max Francis m...@alcyone.com ha scritto: The real reason people still use the `while 1` construct, I would imagine, is just inertia or habit, rather than a conscious, defensive decision. If it's the latter, it's a case of being _way_ too defensive. It's also because while 1 is faster: ... while True: 1.41121292114 while 1: 1.07101011276 Most of the times tha't won't make any noticeable difference, but it's also true that certain while loops are going to iterate milions of times. Think about receiving a 10 GB file by using a socket. You'd tipically have something like this: while 1: chunk = sock.recv(1024): if not chunk: break ... Now, that's a case where I (personally) want to explicitly use while 1 instead of while True. Such a loop would obviously be I/O-bound, not CPU-bound. So changing the form of the while loop would make minimal difference to its overall performance. It'd be spending the vast majority of its time blocked at the OS socket level, not executing the condition of the while loop. As with most of these things, if one is this worried about performance, then either Python was the wrong choice to begin with, or there's a good chance that you're worried about something that isn't actually where the bottleneck is in the first place. -- Erik Max Francis m...@alcyone.com http://www.alcyone.com/max/ San Jose, CA, USA 37 18 N 121 57 W AIM/Y!M/Jabber erikmaxfrancis Think twice before you speak to a friend in need. -- Ambrose Bierce -- http://mail.python.org/mailman/listinfo/python-list Obviously, you're right. I picked up the wrong example. My point is 1.41121292114 vs 1.07101011276 *might* make some difference in certain cases. I just can't come up with a good example where that would be justified. =) --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
ANN: pysendfile 0.2.0 released
Hi folks, I'm pleased to announce the 0.2.0 release of pysendfile: http://code.google.com/p/pysendfile === About === This is a python interface to sendfile(2) system call available on most UNIX systems. sendfile(2) provides a zero-copy way of copying data from one file descriptor to another (a socket). The phrase zero-copy refers to the fact that all of the copying of data between the two descriptors is done entirely by the kernel, with no copying of data into userspace buffers, resuting in file transfers being from 2x to 3x faster. Basically, any application sending files over the network can take advantage of it. HTTP and FTP servers are a typical example. === Supported platforms === * Linux * Mac OSX * FreeBSD * Dragon Fly BSD * Sun OS * AIX (not properly tested) === Supported python versions === From 2.5 to 3.3. === Links === * Home page: http://code.google.com/p/pysendfile * Source tarball: http://pysendfile.googlecode.com/files/pysendfile-0.2.0.tar.gz --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: pysendfile 0.2.0 released
Hi folks, I'm pleased to announce the 0.2.0 release of pysendfile: http://code.google.com/p/pysendfile === About === This is a python interface to sendfile(2) system call available on most UNIX systems. sendfile(2) provides a zero-copy way of copying data from one file descriptor to another (a socket). The phrase zero-copy refers to the fact that all of the copying of data between the two descriptors is done entirely by the kernel, with no copying of data into userspace buffers, resuting in file transfers being from 2x to 3x faster. Basically, any application sending files over the network can take advantage of it. HTTP and FTP servers are a typical example. === Supported platforms === * Linux * Mac OSX * FreeBSD * Dragon Fly BSD * Sun OS * AIX (not properly tested) === Supported python versions === From 2.5 to 3.3. === Links === * Home page: http://code.google.com/p/pysendfile * Source tarball: http://pysendfile.googlecode.com/files/pysendfile-0.2.0.tar.gz --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-list
ANN: psutil 0.4.0 released
Hi folks, I'm pleased to announce the 0.4.0 release of psutil: http://code.google.com/p/psutil === About === psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, disk, memory, network) in a portable way by using Python, implementing many functionalities offered by command line tools such as ps, top, free, lsof and others. It works on Linux, Windows, OSX and FreeBSD, both 32-bit and 64-bit, with Python versions from 2.4 to 3.3 by using a single code base. === Major enhancements === Aside from fixing different high priority bugs this release introduces two new important features: disks and network IO counters. With these, you can monitor disks usage and network traffic. 3 scripts were added to provide an example of what kind of applications can be written with these two hooks: http://code.google.com/p/psutil/source/browse/trunk/examples/iotop.py http://code.google.com/p/psutil/source/browse/trunk/examples/nettop.py http://code.google.com/p/psutil/source/browse/trunk/examples/top.py ...and here you can see some screenshots: http://code.google.com/p/psutil/#Example_applications === Other enhancements == - Process.get_connections() has a new 'kind' parameter to filters for connections by using different criteria. - timeout=0 parameter can now be passed to Process.wait() to make it return immediately (non blocking). - Python 3.2 installer for Windows 64 bit is now provided in downloads section. - (FreeBSD) addeed support for Process.getcwd() - (FreeBSD) Process.get_open_files() has been rewritten in C and no longer relies on lsof. - various crashes on module import across differnt platforms were fixed. For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === New features by example === import psutil psutil.disk_io_counters() iostat(read_count=8141, write_count=2431, read_bytes=290203, write_bytes=537676, read_time=5868, write_time=94922) psutil.disk_io_counters(perdisk=True) {'sda1' :iostat(read_count=8141, write_count=2431, read_bytes=290203, write_bytes=537676, read_time=5868, write_time=94922), 'sda2' :iostat(read_count=811241, write_count=31, read_bytes=1245, write_bytes=11246, read_time=768008, write_time=922)} psutil.network_io_counters() iostat(bytes_sent=1270374, bytes_recv=7828365, packets_sent=9810, packets_recv=11794) psutil.network_io_counters(pernic=True) {'lo': iostat(bytes_sent=800251705, bytes_recv=800251705, packets_sent=455778, packets_recv=455778), 'eth0': iostat(bytes_sent=813731756, bytes_recv=4183672213, packets_sent=3771021, packets_recv=4199213)} import os p = psutil.Process(os.getpid()) p.get_connections(kind='tcp') [connection(fd=115, family=2, type=1, local_address=('10.0.0.1', 48776), remote_address=('93.186.135.91', 80), status='ESTABLISHED')] p.get_connections(kind='udp6') [] p.get_connections(kind='inet6') [] === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.4.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation As a final note I'd like to thank Jeremy Whitlock, who kindly contributed disk/network io counters code for OSX and Windows. Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil 0.4.0 released
Hi folks, I'm pleased to announce the 0.4.0 release of psutil: http://code.google.com/p/psutil === About === psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, disk, memory, network) in a portable way by using Python, implementing many functionalities offered by command line tools such as ps, top, free, lsof and others. It works on Linux, Windows, OSX and FreeBSD, both 32-bit and 64-bit, with Python versions from 2.4 to 3.3 by using a single code base. === Major enhancements === Aside from fixing different high priority bugs this release introduces two new important features: disks and network IO counters. With these, you can monitor disks usage and network traffic. 2 scripts were added to provide an example of what kind of applications can be written with these two hooks: http://code.google.com/p/psutil/source/browse/trunk/examples/iotop.py http://code.google.com/p/psutil/source/browse/trunk/examples/nettop.py ...and here you can see some screenshots: http://code.google.com/p/psutil/#Example_applications === Other enhancements == - Process.get_connections() has a new 'kind' parameter to filters for connections by using different criteria. - timeout=0 parameter can now be passed to Process.wait() to make it return immediately (non blocking). - Python 3.2 installer for Windows 64 bit is now provided in downloads section. - (FreeBSD) addeed support for Process.getcwd() - (FreeBSD) Process.get_open_files() has been rewritten in C and no longer relies on lsof. - various crashes on module import across differnt platforms were fixed. For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === New features by example === import psutil psutil.disk_io_counters() iostat(read_count=8141, write_count=2431, read_bytes=290203, write_bytes=537676, read_time=5868, write_time=94922) psutil.disk_io_counters(perdisk=True) {'sda1' :iostat(read_count=8141, write_count=2431, read_bytes=290203, write_bytes=537676, read_time=5868, write_time=94922), 'sda2' :iostat(read_count=811241, write_count=31, read_bytes=1245, write_bytes=11246, read_time=768008, write_time=922)} psutil.network_io_counters() iostat(bytes_sent=1270374, bytes_recv=7828365, packets_sent=9810, packets_recv=11794) psutil.network_io_counters(pernic=True) {'lo': iostat(bytes_sent=800251705, bytes_recv=800251705, packets_sent=455778, packets_recv=455778), 'eth0': iostat(bytes_sent=813731756, bytes_recv=4183672213, packets_sent=3771021, packets_recv=4199213)} import os p = psutil.Process(os.getpid()) p.get_connections(kind='tcp') [connection(fd=115, family=2, type=1, local_address=('10.0.0.1', 48776), remote_address=('93.186.135.91', 80), status='ESTABLISHED')] p.get_connections(kind='udp6') [] p.get_connections(kind='inet6') [] === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.4.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation As a final note I'd like to thank Jeremy Whitlock, who kindly contributed disk/network io counters code for OSX and Windows. Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: atexit handlers - getting the return code
You mean the registered function return value or the process return code? In the first case you can do something such as: import atexit @atexit.register def cleanup(): def actual_function(): ... return something ret = actual_function() # do something with ret In the latter case you can use sys.exit(code). --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/9/27 Mike Hull mikehul...@googlemail.com: Hi, I work in neuroscience modelling and use python for lots of my work. One problem I have is management of scripts and results. To that end, I have written code that make its easier to keep track of scripts, to see which ones have run, or need to be rerun, to see output errors and generally organise running of scripts better. The way i have implemented it is that I register a function to the atexit module, which takes care of recording information about the script run; such as whether an exception was raised and not caught, and how long it took to run and the stdout/stderr streams; which can then be uploaded into a database. One thing I am struggling to get though is the 'return code' that the is going to be returned after my atexit handlers have finished. Could anyone tell me how it get at this!? Thanks Mike -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
ANN: psutil 0.3.0 released
Hi folks, I'm pleased to announce the 0.3.0 release of psutil: http://code.google.com/p/psutil === Major enhancements === * disk usage * mounted disk partitions * system per-cpu percentage utilization and times * per-process terminal * physical and virtual memory usage including percentage === New features by example === import psutil for x in range(3): ... psutil.cpu_percent(percpu=True) ... [4.0, 34.2] [7.0, 8.5] [1.2, 9.0] psutil.phymem_usage() usage(total=4153868288, used=2854199296, free=1299668992, percent=34.6) psutil.virtmem_usage() usage(total=2097147904, used=4096, free=2097143808, percent=0.0) psutil.get_partitions() [partition(device='/dev/sda3', mountpoint='/', fstype='ext4'), partition(device='/dev/sda7', mountpoint='/home', fstype='ext4')] psutil.disk_usage('/') usage(total=21378641920, used=4809781248, free=15482871808, percent=22.5) psutil.Process(os.getpid()).terminal '/dev/pts/0' Also, a new examples directory showing some examples usages: http://code.google.com/p/psutil/source/browse/#svn%2Ftrunk%2Fexamples For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.3.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil 0.3.0 released
Hi folks, I'm pleased to announce the 0.3.0 release of psutil: http://code.google.com/p/psutil === Major enhancements === * disk usage * mounted disk partitions * system per-cpu percentage utilization and times * per-process terminal * physical and virtual memory usage including percentage === New features by example === import psutil for x in range(3): ... psutil.cpu_percent(percpu=True) ... [4.0, 34.2] [7.0, 8.5] [1.2, 9.0] psutil.phymem_usage() usage(total=4153868288, used=2854199296, free=1299668992, percent=34.6) psutil.virtmem_usage() usage(total=2097147904, used=4096, free=2097143808, percent=0.0) psutil.get_partitions() [partition(device='/dev/sda3', mountpoint='/', fstype='ext4'), partition(device='/dev/sda7', mountpoint='/home', fstype='ext4')] psutil.disk_usage('/') usage(total=21378641920, used=4809781248, free=15482871808, percent=22.5) psutil.Process(os.getpid()).terminal '/dev/pts/0' Also, a new examples directory showing some examples usages: http://code.google.com/p/psutil/source/browse/#svn%2Ftrunk%2Fexamples For a complete list of features and bug fixes see: http://psutil.googlecode.com/svn/trunk/HISTORY === Links === * Home page: http://code.google.com/p/psutil * Source tarball: http://psutil.googlecode.com/files/psutil-0.3.0.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation Please try out this new release and let me know if you experience any problem by filing issues on the bug tracker. Thanks in advance. --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
How to avoid () when writing a decorator accepting optional arguments?
I've written this decorator to deprecate a function and (optionally) provide a callable as replacement def deprecated(repfun=None): A decorator which can be used to mark functions as deprecated. Optional repfun is a callable that will be called with the same args as the decorated function. def outer(fun): def inner(*args, **kwargs): msg = %s is deprecated % fun.__name__ if repfun is not None: msg += ; use %s instead % (repfun.__name__) warnings.warn(msg, category=DeprecationWarning, stacklevel=2) if repfun is not None: return repfun(*args, **kwargs) else: return fun(*args, **kwargs) return inner return outer Now, I can use my decorator as such: @deprecated() def foo(): return 0 ...or provide an optional argument: @deprecated(some_function) def foo(): return 0 ...but I don't know how to modify it so that I can omit parentheses: @deprecated def foo(): return 0 Any hint? --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: smtplib is broken when using TLS
Please file a ticket on: http://bugs.python.org/ Regards, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/5/17 nirinA raseliarison nirina.raseliari...@gmail.com: i think this has the same origin as the ftplib test failure. Python 3.2.1rc1 (default, May 17 2011, 22:01:34) [GCC 4.6.0] on linux2 Type copyright, credits or license() for more information. RESTART send: 'ehlo [127.0.0.1]\r\n' reply: b'250-mx.google.com at your service, [41.188.13.184]\r\n' reply: b'250-SIZE 35882577\r\n' reply: b'250-8BITMIME\r\n' reply: b'250-STARTTLS\r\n' reply: b'250 ENHANCEDSTATUSCODES\r\n' reply: retcode (250); Msg: b'mx.google.com at your service, [41.188.13.184]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES' send: 'STARTTLS\r\n' reply: b'220 2.0.0 Ready to start TLS\r\n' reply: retcode (220); Msg: b'2.0.0 Ready to start TLS' Traceback (most recent call last): File /root/template_mail_text.py, line 49, in module server.starttls() File /usr/local/lib/python3.2/smtplib.py, line 649, in starttls self.sock = ssl.wrap_socket(self.sock, keyfile, certfile) File /usr/local/lib/python3.2/ssl.py, line 509, in wrap_socket ciphers=ciphers) File /usr/local/lib/python3.2/ssl.py, line 266, in __init__ raise x File /usr/local/lib/python3.2/ssl.py, line 262, in __init__ self.do_handshake() File /usr/local/lib/python3.2/ssl.py, line 441, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [Errno 1] _ssl.c:392: error:140943FC:SSL routines:SSL3_READ_BYTES:sslv3 alert bad record mac -- nirinA -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: test_argparse.py FAILED (failures=6)
There's no point in posting this here. Use the bug tracker: http://bugs.python.org/ --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/5/17 nirinA raseliarison nirina.raseliari...@gmail.com: == FAIL: test_failures_many_groups_listargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File Lib/test/test_argparse.py, line 216, in wrapper test_func(self) File Lib/test/test_argparse.py, line 235, in test_failures raises(ArgumentParserError, parser.parse_args, args) AssertionError: ArgumentParserError not raised by parse_args == FAIL: test_failures_many_groups_sysargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File Lib/test/test_argparse.py, line 216, in wrapper test_func(self) File Lib/test/test_argparse.py, line 235, in test_failures raises(ArgumentParserError, parser.parse_args, args) AssertionError: ArgumentParserError not raised by parse_args == FAIL: test_failures_no_groups_listargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File Lib/test/test_argparse.py, line 216, in wrapper test_func(self) File Lib/test/test_argparse.py, line 235, in test_failures raises(ArgumentParserError, parser.parse_args, args) AssertionError: ArgumentParserError not raised by parse_args == FAIL: test_failures_no_groups_sysargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File Lib/test/test_argparse.py, line 216, in wrapper test_func(self) File Lib/test/test_argparse.py, line 235, in test_failures raises(ArgumentParserError, parser.parse_args, args) AssertionError: ArgumentParserError not raised by parse_args == FAIL: test_failures_one_group_listargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File Lib/test/test_argparse.py, line 216, in wrapper test_func(self) File Lib/test/test_argparse.py, line 235, in test_failures raises(ArgumentParserError, parser.parse_args, args) AssertionError: ArgumentParserError not raised by parse_args == FAIL: test_failures_one_group_sysargs (__main__.TestFileTypeW) -- Traceback (most recent call last): File Lib/test/test_argparse.py, line 216, in wrapper test_func(self) File Lib/test/test_argparse.py, line 235, in test_failures raises(ArgumentParserError, parser.parse_args, args) AssertionError: ArgumentParserError not raised by parse_args -- Ran 1599 tests in 6.298s FAILED (failures=6) Traceback (most recent call last): File Lib/test/test_argparse.py, line 4681, in module test_main() File Lib/test/test_argparse.py, line 4673, in test_main support.run_unittest(__name__) File /mnt/sda14/pack_build/Python-3.2.1rc1/Lib/test/support.py, line 1184, in run_unittest _run_suite(suite) File /mnt/sda14/pack_build/Python-3.2.1rc1/Lib/test/support.py, line 1167, in _run_suite raise TestFailed(err) test.support.TestFailed: multiple errors occurred -- nirinA -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
ANN: psutil (python process utilities) 0.2.1 released
Hi, I'm pleased to announce the 0.2.1 release of psutil: http://code.google.com/p/psutil === About === psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat. It currently supports Linux, Windows, OS X and FreeBSD both 32-bit and 64-bit with Python versions from 2.4 to 3.2 by using a unique code base. === Major enhancements === * per-process I/O counters * per-process wait() (wait for process to terminate and return its exit code) * per-process get_threads() returning information (id, user and kernel times) about threads opened by process. * per-process real, effective and saved user and group ids. * per-process get and set niceness (priority) * per-process status * per-process I/O nice (priority) - Linux only * psutil.Popen class which tidies up subprocess.Popen and psutil.Process in a unique interface. * system boot time === New features by example === p = psutil.Process(7055) p.name 'python' str(p.status) 'running' p.uids user(real=1000, effective=1000, saved=1000) p.gids group(real=1000, effective=1000, saved=1000) p.nice 0 p.nice = 10 # set/change process priority p.nice 10 p.get_ionice() ionice(ioclass=0, value=0) p.set_ionice(psutil.IOPRIO_CLASS_IDLE) # change process I/O priority p.get_ionice() ionice(ioclass=3, value=0) p.get_io_counters() io(read_count=478001, write_count=59371, read_bytes=700416, write_bytes=69632) p.get_threads() [thread(id=5234, user_time=22.5, system_time=9.2891), thread(id=5235, user_time=0.0, system_time=0.0), thread(id=5236, user_time=0.0, system_time=0.0), thread(id=5237, user_time=0.0707, system_time=1.2)] p.terminate() p.wait(timeout=3) 0 = new subprocess interface = import psutil from subprocess import PIPE p = psutil.Popen([/usr/bin/python, -c, print 'hi'], stdout=PIPE) p.name 'python' p.uids user(real=1000, effective=1000, saved=1000) p.username 'giampaolo' p.communicate() ('hi\n', None) p.terminate() p.wait(timeout=2) 0 === Links === * Home page: http://code.google.com/p/psutil * Mailing list: http://groups.google.com/group/psutil/topics * Source tarball: http://psutil.googlecode.com/files/psutil-0.2.1.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: psutil (python process utilities) 0.2.1 released
Hi, I'm pleased to announce the 0.2.1 release of psutil: http://code.google.com/p/psutil === About === psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat. It currently supports Linux, Windows, OS X and FreeBSD both 32-bit and 64-bit with Python versions from 2.4 to 3.2 by using a unique code base. === Major enhancements === * per-process I/O counters * per-process wait() (wait for process to terminate and return its exit code) * per-process get_threads() returning information (id, user and kernel times) about threads opened by process. * per-process real, effective and saved user and group ids. * per-process get and set niceness (priority) * per-process status * per-process I/O nice (priority) - Linux only * psutil.Popen class which tidies up subprocess.Popen and psutil.Process in a unique interface. * system boot time === New features by example === p = psutil.Process(7055) p.name 'python' p.status 0 str(p.status) 'running' p.uids user(real=1000, effective=1000, saved=1000) p.gids group(real=1000, effective=1000, saved=1000) p.nice 0 p.nice = 10 # set/change process priority p.nice 10 p.get_ionice() ionice(ioclass=0, value=0) p.set_ionice(psutil.IOPRIO_CLASS_IDLE) # change process I/O priority p.get_ionice() ionice(ioclass=3, value=0) p.get_io_counters() io(read_count=478001, write_count=59371, read_bytes=700416, write_bytes=69632) p.get_threads() [thread(id=5234, user_time=22.5, system_time=9.2891), thread(id=5235, user_time=0.0, system_time=0.0), thread(id=5236, user_time=0.0, system_time=0.0), thread(id=5237, user_time=0.0707, system_time=1.2)] p.terminate() p.wait(timeout=3) 0 = new subprocess interface = import psutil from subprocess import PIPE p = psutil.Popen([/usr/bin/python, -c, print 'hi'], stdout=PIPE) p.name 'python' p.uids user(real=1000, effective=1000, saved=1000) p.username 'giampaolo' p.communicate() ('hi\n', None) p.terminate() p.wait(timeout=2) 0 === Links === * Home page: http://code.google.com/p/psutil * Mailing list: http://groups.google.com/group/psutil/topics * Source tarball: http://psutil.googlecode.com/files/psutil-0.2.1.tar.gz * Api Reference: http://code.google.com/p/psutil/wiki/Documentation --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: attach to process by pid?
I think he wants to attach to another process's stdin/stdout and read/write from/to them. I don't know if this is possible but it would be a great addition for psutil. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/3/10 Miki Tebeka miki.teb...@gmail.com: Is there any way to attach to an already running process by pid? I want to send commands from python to an application that is already running. I don't want to give the command name to subprocess.Popen. We probably need more information. What do you mean by send commands? (What was your work flow if you could give the command name to Popen?) -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE: A cornicopia of mediocrity and obfuscation.
So what you're actually telling is that Python won't survive another 10 years because: - IDLE is it's default editor - idlelib directory is the first place you should look every time you need an inspiration on how code should be written - code in idlelib directory sucks That's an interesting point and I thank you for pointing that out. Personally I've never looked into idlelib directory for 7 years in a row at all. I was probably doing some other things, I don't know, but now I'm definitively gonna start looking for a new language because it's clear that any language having a directory called idlelib within such a horrible source code is not gonna last for long. Thanks again, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/1/31 rantingrick rantingr...@gmail.com: PLEASE KINDLY IGNORE MY FIRST TWO POSTS: Due to some errors i need to repost. Thank you. IDLE: A cornicopia of mediocrity and obfuscation. -- by Rick Johnson IDLE --which is the Python Integrated Development and Learning Environment-- was once the apple of Guido's eye but has since degenerated into madness many years ago and remains now as the shining jewel show piece on the proverbial python wall of shame. A once mighty dream of programming for everyone that is now nothing more than an example of how NOT to program. IDLE contains some of the worst code this community has created. Bad design patterns, tacked on functionality, blasphemous styling, and piss poor packaging. There seems to be no guiding goals or game-plan. And year after year if IDLE *does* get any attention it's just more haphazard code thrown into the mix by someone who has gone blind from reading the source. However we cannot blame the current maintainer -- if any such even exists-- because NOBODY can maintains such a spaghetti mess that this package has become! If we would have had a proper game plan from day one i believe we could have avoided this catastrophe. Follows is an outline of the wrongs with some suggestions to right them... * First of all the main two modules PyShell and EditorWindow are laid out in such a non sequential way that it is virtually impossible to follow along. We should have had a proper app instance from which all widgets where combined. The main app should have followed a common sense sequential mentality of... * subclassing the tk.Toplevel * initializing instance variables * creating the main menu * creating the sub widgets * declaring internal methods * declaring event handlers * interface/generic methods. ... This is the recipe for order AND NOT CHAOS! What we have now is utter chaos! When we have order we can read source code in a sequential fashion. When we have order we can comprehend what we read. And when we have order we can maintain a library/package with ease. However sadly we DO NOT have order, we have CHAOS, CHAOS, and more CHAOS! * The underlying sub widgets should have started with their own proper order of declared initialization. And all events should be handled in the widget at hand NOT outsourced to some other class! * One of the biggest design flaws is the fact that outside modules manipulate the main editor/pyshells events. This is a terrible way to code. For example the AutoCompleteWindow takes over the tab event. This is a bad design! The main editor window should handle all its own events AND THEN call outside class methods when needed... #-- Puesdo Code --# # in editor window __init__ self.autocomplete = AutoComplete(blah) # in editor window onKeyPress(blah) if key == 'Tab' and blah: self.autocomplete.show_tip(blah) elif key == 'Escape' and acw.is_visibe(): self.autocomplete.hide() ...We don't want Mommy classes telling the kids what to do, when to eat, when to sleep, and when to excrete! We should create our objects with the virtue of self reliance and responsibility!. The Colorizer, ParenMatch, CallTips, and many other modules are guilty of event stealing also. Event functionality must be handled in the widget itself, NOT stolen and handled in an outside class. When we split up sequential code we get CHAOS! * Another bad choice was creating custom reusable widgets (Tabbedpages, FindDialog, ReplaceDialog, textView, TreeWidget, etc...) and leaving them in idlelib. These should have been moved into the lib- tk folder where they would be more visible to python programmers AND we could reduce the cruft in the idlelib! Remember, when we create more files, folders, and objects we create CHAOS. And nobody can learn from CHAOS! * Another blasphemy is the fact that every module should include some sort of test/demo to display its usage. If the module is a GUI widget then you MUST show how to use the widget in a window. Sadly like all everything else, idlelib is devoid of examples and testing. And the very few tests that DO exists just blow chunks! * Last but not least
Re: IDLE: A cornicopia of mediocrity and obfuscation.
2011/1/31 rantingrick rantingr...@gmail.com: In an ideal world it should be the first place you look when wanting to learn how to build medium sized GUI projects with the built-in Tkinter module. I wouldn't do that, and thankfully in the *real* world what is considered more important usually gets more attention. If instead of ranting nonsense all day long you would spend a little bit of your time by taking a look at how crowded the python bug tracker already is, you would discover an interesting thing which goes under the name of priority. High priority bugs get fixed first. IDLE source code is clearly not a high priority issue, hence it doesn't get fixed: end of story. Actually I don't even understand how can IDLE source code quality have anything to do with python success or future adoption, as you implied in your statements. And why do you care so much anyway? You have spent the past 5 days blabbing about how bad Tkinter is, how ugly and useless it is nowadays, and now you suddenly care about IDLE source code quality? Do you have any idea how ridiculous this looks from the outside? However the reality is ANYTHING but ideal. The code is rotten to the core, full of inconsistencies and just very unpythonic. 99% of the times the right answer to this statement is go file a bug and possibly provide a patch but not in your case since it's clear that you have absolutely no interest in resolving *anything*, let alone actually write some code, assuming you're able to do so in the first place. Personally I've never looked into idlelib directory for 7 years in a row at all. I was probably doing some other things, I don't know, but now I'm definitively gonna start looking for a new language because it's clear that any language having a directory called idlelib within such a horrible source code is not gonna last for long. Well not unless we do something about it. It is high time to stop patching, bolting on, and future extending the suffering of this horrendous code base. It is time to pull the plug, let it die, and start fresh. Start from a real python perspective. We can learn from past mistakes and build something much better. But will we? Do we have the community spirit to take on this challenge? Do we as a community have any fire left or have we collectively waxed cold? How can you possibly not understand that I was being sarcastic? --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Bugs/issues in tkinter.simpledialog!!
2011/1/26 rantingrick rantingr...@gmail.com: I just installed Python 3,0 on my machine. I cannot use 3.0 exclusively yet however i was interested in just poking around and acquiring a taste if you will. I was happy to find that the new Tkinter module names now follow convention and are placed correctly... example: tkinter.simpledialog However some things never change it seems and some improvements are actually a step backwards. The same problems with the unit test in 2.x got ported to 3.x. And the new SimpleDialog is just more lackluster code like we've seen before. I was hoping to be amazed, i am disappointed and disgusted. It is obvious that whoever is writing/ maintaining the tkinter code base does NOT understand tkinter completely and this is blinding apparent by reading the source code! --- Issues --- First lets start with the problems that migrated from 2.x... (tkinter.simpledialog) #-- ISSUE 1 --# In the test() function we still have code that uses the quit method instead of destroy. Calling the quit method only tells Tkinter to stop processing events, IT DOES NOT DESTROY THE WIDGET!! And on windows the the root will then become unresponsive -- you cannot close the window, you cannot do anything. I have said time and time again. DO NOT USE THE QUIT METHOD UNLESS YOU KNOW WHAT THE HECK YOU ARE DOING! So the code needs to be this... OLD: q = Button(root, text='Quit', command=t.quit) NEW: q = Button(root, text='Quit', command=root.destroy) #-- ISSUE 2: --# The author used a very strange method by which to denote the default button in the SimpleDialog class. He choose to set the relief to RIDGE and the border 8. This not only looks horrible (and exposes the authors ignorance of tkinter) but a much more elegant solution is provided by the TclTk folks. All buttons have a default option that will display the button with a nice border so the user can visually see which button is active. So the code should be this OLD: if num == default: b.config(relief=RIDGE, borderwidth=8) NEW: if num == default: b.config(default=ACTIVE) Last but not least i am puzzled as to why we choose the method name go over show. for showing the dialog. SimpleDialog uses no inheritance so name clashes are mum. Why would anyone choose go over show for a modal dialog? I would really like an explanation for this. Other minor issues exists. I may describe them later. At this time we need to fix these grave abominations first. -- http://mail.python.org/mailman/listinfo/python-list Why don't you file a ticket on the bug tracker instead of wasting yours and other people's time here by making appear another rant against Tkinter as a bug report? It's been 3 days in a row you've been doing this. Aren't you tired? Seriously! This has come to not even being a rant anymore. It's just nonsense. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Use the Source Luke
2011/1/28 Raymond Hettinger pyt...@rcn.com: I hoping a new trend will start with dev's putting direct source code links in their documentation: http://rhettinger.wordpress.com/2011/01/28/open-your-source-more/ I'm looking for more examples of projects that routinely link their docs back into relavant sections of code. Have any of you all seen other examples besides the Go language docs and the Python docs? Raymond -- http://mail.python.org/mailman/listinfo/python-list Thanks, I think this is a great idea. I think this definitively should be done for 2.7 documentation as well. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: WxPython versus Tkinter.
wxPython is not suitable for inclusion for many reasons. One reason is that it is a *huge* library which requires a lot of constant work (bugfixing, documentation, lots of commits, etc...) which cannot weight on python development. Keeping the two worlds separated is better for both of them, especially for wxPython which doesn't have to follow the strict politics surrounding the python stdlib. For example, wxPython is free to break some API backward compatibility on every new major version if this is desired. Such a thing couldn't happen if it were in the stdlib for obvious reasons. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/1/26 Brendan Simon (eTRIX) brendan.si...@etrix.com.au: Since it seems the python motto is Batteries included, then it would seem to me that wxPython is the natural fit as it also has Batteries included (e.g. accessibility, native look-n-feel, mature and evolving, can produce simple or complex gui programs, etc, etc). -- Brendan Simon www.etrix.com.au -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: WxPython versus Tkinter.
It might be true, however I have seen some modules that say that are ment for Python 2.5, for 2.6 or for 2.7, so there seem to be differences between these versions also. Python cares *a lot* about maintaining backward compatibiilty between all major versions. This is so true that I managed to use a unique code base for pyftpdlib which supports python from 2.3 to 2.7. Same for psutil which covers versions from 2.4 to 3.2 by using a unique code base! It might be true, however I have seen some modules that say that are ment for Python 2.5, for 2.6 or for 2.7, so there seem to be differences between these versions also. Usually the differences between one version and another rely on *new features* only. One might decide to target a module only for a certain version of the 2.x serie because that certain version introduced a new functionnality which was not available before (silly example http://docs.python.org/library/os.html#os.initgroups ). All the other functionnalities are likely to remain the same and fully backward compatible. py2exe offers the following installation kits, depending on the Python version. If you know, please tell me why there are different packages for different versions of Python? py2exe-0.6.9.win32-py2.5.exe py2exe-0.6.9.win32-py2.4.exe py2exe-0.6.9.win32-py2.3.exe py2exe-0.6.9.win32-py2.6.exe py2exe-0.6.9.win32-py2.7.exe That's a different story: those are pre-compiled binaries which are generated from a *unique* source code which support all those versions. If you have a compiler you can install pywin32 extension by using any Python version. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/1/27 Octavian Rasnita orasn...@gmail.com: From: Emile van Sebille em...@fenx.com On 1/26/2011 11:02 PM Octavian Rasnita said... As we all know, Python doesn't care too much about maintaining a backward compatibility Where'd you get this idea? Between v2 and v3 yes, that was the intent. To be sincere I was thinking to the differences between Python 2 and 3. But otherwise, I think there's another miscommunication behind this... It might be true, however I have seen some modules that say that are ment for Python 2.5, for 2.6 or for 2.7, so there seem to be differences between these versions also. py2exe offers the following installation kits, depending on the Python version. If you know, please tell me why there are different packages for different versions of Python? py2exe-0.6.9.win32-py2.5.exe py2exe-0.6.9.win32-py2.4.exe py2exe-0.6.9.win32-py2.3.exe py2exe-0.6.9.win32-py2.6.exe py2exe-0.6.9.win32-py2.7.exe Thanks. Octavian -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: WxPython versus Tkinter.
2011/1/24 rantingrick rantingr...@gmail.com: On Jan 24, 2:56 am, Martin v. Loewis mar...@v.loewis.de wrote: Well Rick, this doesn't make look wxPython any better. Well Martin this seems to be a Linux problem. And it may be a debian problem. Every Google search i landed on with wxPython+imagelist +sefault the user mentioned debian...hmm?. Has anybody tested this on Unbuntu? And if it segfaults on Ubuntu that just means you Linux guys need to do some debugging and offer a solution instead of pointing fingers. Linux OS is not a hand holding OS so stop your belly aching. All you guys know damn good and we can make wxPython completely cross platform. However the fact is that you DO NOT want to consider wxPython so you're NOT going to actually put forth some solutions. This thread has been an eye opener for myself and many people in the fact that this community has both lost vision and the apathy is so demoralizing that we cannot even work together to get some simple code debugged. The spirit of community, and each helping one another, does not exists! Congratulations python community, you have failed yourself! :( -- http://mail.python.org/mailman/listinfo/python-list This is nonsense and you are clearly a troll. =) --- Giampaolo Rodolà http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
ANN: pyftpdlib 0.6.0 released
Hi, I'm pleased to announce release 0.6.0 of Python FTP Server library (pyftpdlib). http://code.google.com/p/pyftpdlib/ === About === Python FTP server library provides an high-level portable interface to easily write asynchronous FTP/S servers with Python. Based on asyncore framework pyftpdlib is currently the most complete RFC-959 FTP server implementation available for Python programming language. === Major changes === This new version, aside from fixing some bugs, includes some important new features: * (finally) full FTPS (FTP over SSL/TS) support * configurable command line options * a standardized and improved logging system for commands and transfers * possibility to serve both IPv4 and IPv6 by using a single socket * enhanced Unix and Windows authorizers, moved from demo directory and included in main library with a set of new options such as the possibility to specify which users should be granted for access. * enabled TCP_NODELAY socket option for the FTP command channels resulting in pyftpdlib being twice faster. * a new UnixFilesystem class which permits the client to escape its home directory and navigate the real filesystem. A complete list of changes including enhancements, bug fixes and instructions for using the new functionalities is available here: http://code.google.com/p/pyftpdlib/wiki/ReleaseNotes06 If you think pyftpdlib is worth a donation you can do so by going here: http://code.google.com/p/pyftpdlib/wiki/Donate === More links === * Source tarball: http://pyftpdlib.googlecode.com/files/pyftpdlib-0.6.0.tar.gz * Online docs: http://code.google.com/p/pyftpdlib/wiki/Tutorial * FAQs: http://code.google.com/p/pyftpdlib/wiki/FAQ * RFCs compliance paper: http://code.google.com/p/pyftpdlib/wiki/RFCsCompliance * Issue tracker: http://code.google.com/p/pyftpdlib/issues/list Thanks, -- Giampaolo Rodola' g.rodola [at] gmail [dot] com -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems with FTP
The solution proposed on stackoverflow: from ftplib import FTP site = FTP('my_proxy') site.set_debuglevel(1) msg = site.login('anonymous at ftp.download.com', 'password') site.cwd('/pub') ...can not work. The anonymous at ftp.download.com part is pure fiction. Nothing like that has ever been mentioned in any RFC or implemented/supported by any server, as far as I know. I'd say the only way to proxy FTP is by using a SOCKS proxy. By looking at the error message it's likely that the company firewall is just blocking the FTP traffic. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/1/21 Thomas Jollans tho...@jollybox.de: On Friday 21 January 2011, it occurred to RizlaJ to exclaim: Hi all, I'm very new to python. I'm using Python 2.7, in a corporate environment, therefore am behind a proxy server, firewalls etc. I can ftp to a barclays capital ftp site ok in internet explorer, but I can't get the FTP from ftplib to work for me. Can someone please help! It sounds very much like, as you said, you're behind a proxy, and have to use that proxy to connect to the FTP server. If you don't know the proxy settings, you might be able to find them in the IE configuration, or ask the local sysadmin. http://stackoverflow.com/questions/1293518/proxies-in-python-ftp-application It looks like you will have to ftp to the proxy server. Depending on the application, you might be able to use urllib2 instead. Thomas I've tried the following commands from my home personal machine (thefore no proxies etc) and the commands work fine and I'm able to enter my username and password and login successfuly - however in teh corporate environment I can't. I'm wondering if this is soemthing to do with security permissioning at work etc? At the shell I'm typing:- from ftplib import FTP ftp = FTP('indexftp.barcap.com') and get the following error: Traceback (most recent call last): File pyshell#19, line 1, in module ftp = FTP('indexftp.barcap.com') File C:\Python27\lib\ftplib.py, line 117, in __init__ self.connect(host) File C:\Python27\lib\ftplib.py, line 132, in connect self.sock = socket.create_connection((self.host, self.port), self.timeout) File C:\Python27\lib\socket.py, line 571, in create_connection raise err error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond I wasn't expecting this error message next, i was expecting to be able to log on using the followign command :- ftp.login(username,password) Please help! thanks! -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems with FTP
The standard FTP protocol does not supporty any kind of proxy-ing feature natively. The only closest thing to the concept of a proxy we can find in the FTP protocol is the site-to-site transfer feature: http://code.google.com/p/pyftpdlib/wiki/FAQ#What_is_FXP? ...but it's something different. By taking a look at your code, though, this is out of question anyway since you can't even connect to the server, let alone send proxy-like (non-standard) commands. I'd focus on investigating whether it's something with the internal network and forget about proxy-related problems since from here I can connect to indexftp.barcap.com. As for urllib's proxy option I'd say it's only valid for HTTP protocol. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2011/1/21 RizlaJ razajaffre...@gmail.com: Hi Tom, Giampaolo, Thank you both for your swift replies. I have asked our IT dept to see if it is the firewall that is blocking the FTP. They are working on that side of things. However I would have thought that the following or some version of it would have worked:- import urllib proxies = ({'ftp':proxyserveraddress'}) some_url = ({'ftp':'indexftp.barcap.com'}) filehandle = urllib.urlopen(some_url, proxies=proxies) Traceback (most recent call last): File pyshell#51, line 1, in module filehandle = urllib.urlopen(some_url, proxies=proxies) File C:\Python27\lib\urllib.py, line 84, in urlopen return opener.open(url) File C:\Python27\lib\urllib.py, line 177, in open fullurl = unwrap(toBytes(fullurl)) File C:\Python27\lib\urllib.py, line 1026, in unwrap url = url.strip() AttributeError: 'dict' object has no attribute 'strip' However as you can see there is an error - is this again related to the firewall do you think? Sorry for asking stupid questions! and thank you for your help in advance. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: using python ftp
Starting from Python 2.7, yes: http://docs.python.org/library/ftplib.html#ftplib.FTP_TLS Regards, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2010/12/23 Octavian Rasnita orasn...@gmail.com: Can this lib also work with ftps? Thanks. Octavian - Original Message - From: Anurag Chourasia anurag.choura...@gmail.com To: Matt Funk maf...@nmsu.edu Cc: python-list@python.org Sent: Thursday, December 23, 2010 4:12 AM Subject: Re: using python ftp Hi Matt, I have a snippet to upload files (that match a particular search pattern) to a remote server. Variable names are self explanatory. You could tweak this a little to download files instead. from ftplib import FTP ftp = FTP(hostname) ftp.login(user_id,passwd) ftp.cwd(remote_directory) files_list=glob.glob(file_search_pattern) for file in files_list: try: ftp.storlines('STOR ' + file, open(file)) except Exception, e: print ('Failed to FTP file: %s' %(file)) ftp.close() Regards, Anurag On Thu, Dec 23, 2010 at 5:33 AM, Matt Funk maf...@nmsu.edu wrote: Hi, i was wondering whether someone can point me whether the following already exists. I want to connect to a server , download various files (for whose name i want to be able to use a wildcard), and store those files in a given location on the hard drive. If the file already exists i do not want to download it. This seems fairly trivial and i would assume that there should be some sort of implementation that does this easily but i didn't find anything googling it. Otherwise i was going to do it by hand using ftplib: 1) connect to server, 2) change to directory on server 3) get listing 4) match the file pattern i want to the listing 5) check if file already exists 6) download file if matched and doesn't exist Can anyone offer any advice whether this already done somewhere? thanks matt -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance
2010/11/24 Raymond Hettinger pyt...@rcn.com: I'm writing-up more guidance on how to use super() and would like to point at some real-world Python examples of cooperative multiple inheritance. Google searches take me to old papers for C++ and Eiffel, but that don't seem to be relevant to most Python programmers (i.e. a WalkingMenu example where a submenu is both a Entry in a Menu and a Menu itself). Another published example is in a graphic library where some widgets inherit GraphicalFeature methods such as location, size and NestingGroupingFeatures such as finding parents, siblings, and children. I don't find either of those examples compelling because there is no particular reason that they would have to have overlapping method names. So far, the only situation I can find where method names necessarily overlap is for the basics like __init__(), close(), flush(), and save() where multiple parents need to have their own initialization and finalization. If you guys know of good examples, I would appreciate a link or a recap. Thanks, Raymond -- http://mail.python.org/mailman/listinfo/python-list In pyftpdlib I used multiple inheritance to implement FTP over SSL: http://code.google.com/p/pyftpdlib/source/browse/tags/release-0.5.2/demo/tls_ftpd.py#125 I can't say it's been natural/intuitive though, and it took me a while to make it work properly. super() is one of the few things in Python I really don't understand properly. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
ANN: psutil 0.2.0 released
Hi, I'm pleased to announce the 0.2.0 release of psutil: http://code.google.com/p/psutil === About === psutil is a module providing an interface for retrieving information on running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat. It currently supports Linux, Windows, OS X and FreeBSD both 32-bit and 64-bit with Python versions from 2.4 to 3.2 by using a unique code base. === Major enhancements === * per-process open files * per-process TCP/UPD connections * per-process children * per-process executable name * per-process number of threads * per-process send_signal() and terminate() methods * system cached and buffer memory * support for Windows 64-bit (XP, Vista, 7) and Windows 2000 * mingw compiler support === Links === * Home page: http://code.google.com/p/psutil * Mailing list: http://groups.google.com/group/psutil/topics * Source tarball: http://psutil.googlecode.com/files/psutil-0.2.0.tar.gz * Windows Installer (Python 2.7): http://psutil.googlecode.com/files/psutil-0.2.0.win32-py2.7.exe * Api Reference: http://code.google.com/p/psutil/wiki/Documentation --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] pyOpenSSL 0.11 released
2010/11/1 exar...@twistedmatrix.com: Hello all, I'm happy to announce the release of pyOpenSSL 0.11. The primary change from the last release is that Python 3.2 is now supported. Python 2.4 through Python 2.7 are still supported as well. This release also fixes a handful of bugs in error handling code. It also adds APIs for generating and verifying cryptographic signatures and it improves the test suite to cover nearly 80% of the implementation. Downloads and more details about the release can be found on the release page: https://launchpad.net/pyopenssl/main/0.11 Enjoy, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list Congratulations! --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: send command to parent shell
On Wed, 13 Oct 2010 06:30:15 -0700, Martin Landa wrote: is there a way how to send command from python script to the shell (known id) from which the python script has been called? By using psutil (http://code.google.com/p/psutil/): giampa...@ubuntu:~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. import psutil, os me = psutil.Process(os.getpid()) me.name 'python' parent = me.parent parent.name 'bash' parent.kill() Regards, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: send command to parent shell
Sorry I realize now that you wrote how to send a command to the shell and not how to kill the shell. In this case I don't know exactly what you mean. Regards, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ 2010/10/14 Giampaolo Rodolà g.rod...@gmail.com: On Wed, 13 Oct 2010 06:30:15 -0700, Martin Landa wrote: is there a way how to send command from python script to the shell (known id) from which the python script has been called? By using psutil (http://code.google.com/p/psutil/): giampa...@ubuntu:~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. import psutil, os me = psutil.Process(os.getpid()) me.name 'python' parent = me.parent parent.name 'bash' parent.kill() Regards, --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python package to read .7z archives?
2010/8/4 Hallvard B Furuseth h.b.furus...@usit.uio.no: Is there an equivalent of zipfile.py for .7z archives? I have one which extracts an archive member by running 7z e -so, but that's a *slow* way to read one file at a time. Google found me some python interfaces to lzma, but apparently they only handle single compressed files, not .7z archives. (Actually another archive format would be fine if it is competitive. I'm just looking to compress my .zips better. I need a Python module to extract members reasonably fast, but slow compression would be OK.) -- Hallvard -- http://mail.python.org/mailman/listinfo/python-list http://bugs.python.org/issue5689 --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)
2010/7/8 Michele Simionato michele.simion...@gmail.com: On Jul 7, 10:55 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jul 7, 1:31 am, Paul McGuire pt...@austin.rr.com wrote: I just couldn't get through on the python-dev list that I couldn't just upgrade my code to 2.6 and then use 2to3 to keep in step across the 2-3 chasm, as this would leave behind my faithful pre-2.6 users. This is a point I do not understand. My recent module plac is meant to work from Python 2.3 to Python 3.1 and to this goal I make use of 2to3 at the *client* side. Users of Python 2.X get the original code with no magic whatsoever; users of Python 3.X get the same code, but at installation time 2to3 is run by the setup.py script. The mechanism requires distribute to be installed, but I would say that having distribute is a must for Python 3.X users; Python 2.X users do not need anything, so the approach is backward compatible. I thought this was the recommended way of using 2to3 and so far is working for me. M. Simionato -- http://mail.python.org/mailman/listinfo/python-list I used the same approach (2.x default code base which gets translated by 2to3 at installation time) and I managed to do this with distutils alone by doing a little hack in setup.py. Take a look at: http://code.google.com/p/psutil/source/browse/tags/release-0.1.3/setup.py#11 Regards, --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3 - Is PIL/wxPython/PyWin32 supported?
2010/7/7 durumdara durumd...@gmail.com: Hi! I have an environment under Python 2.6 (WinXP). That is based on PIL, wxPython/PyWin32. In the project's pages I see official installer for only PyWin32. I don't know that PIL or wxPython supports Python 3 or not. May with some trick these packages are working. Does anybody know about it? Can I replace my Py2.6 without lost PIL/wxPython? Thanks for your help: dd -- http://mail.python.org/mailman/listinfo/python-list No, as of now you just can't. Now that 2.7 is out and is officially declared as the last 2.x release it's likely that there will be a lot more traction in porting such big names to Python 3. --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)
2010/7/6 David Cournapeau courn...@gmail.com: Or is there no change at the C level? That would make things easy. There are quite a few, but outside of the big pain point of strings/byte/unicode which is present at python level as well, a lot of the issues are not so big (and even simpler to deal with). For example, although numpy took time to port (and is still experimental in nature), it took me a couple of hours to get a basic scipy working (numpy uses a lot of C api dark corners, whereas scipy is much more straightforward in its usage of the C API). David -- http://mail.python.org/mailman/listinfo/python-list As for this aspect, I made a port as such (C extension) for psutil, and it hasn't been too difficult, I must admit. For those interested here is a detailed explanation of all the steps I faced, along with revision changes: http://code.google.com/p/psutil/issues/detail?id=75can=1q=python%203colspec=ID%20Summary%20Type%20Opsys%20Status%20Milestone%20Opened%20Owner%20Progress#c9 --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil/ -- http://mail.python.org/mailman/listinfo/python-list
Re: start and kill process by command promt
There's no need to use taskill.exe; keep a reference of the subprocess.Popen() object around and use its kill() method instead. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/6/21 shanti bhushan ershantibhus...@gmail.com: On Jun 21, 10:41 am, shanti bhushan ershantibhus...@gmail.com wrote: Hi, I want to invoke local wen server named mogoose, and kill it after some time by python script. Then i want to change the argument and invoke it again. I am able to do this with below code. import subprocess import time def invoke_server1(): s1ret=subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C D: \372\pythonweb\mongoose-2.8.exe YourOutput.txt') print s1ret def invoke_server2(): s2ret=subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C D: \372\pythonweb\mongoose-2.8.exe -root D:\New1\ YourOutput.txt') print s2ret def invoke_server3(): s3ret=subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C D: \372\pythonweb\mongoose-2.8.exe -root D:\New2\ YourOutput.txt') print s3ret def kill_server(): killret=subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c taskkill /F /IM mongoose-2.8.exe YourOutput1.txt') print killret kill_server() time.sleep(5) invoke_server1() time.sleep(5) kill_server() time.sleep(5) invoke_server2() time.sleep(5) kill_server() time.sleep(10) invoke_server3() time.sleep(5) kill_server() This works fine in python26 ,but when i use this code in one testing tool, server is invoked 1st time properly.but for second time it says process already occupied cannot access the process. I am not able to understand why subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c taskkill /F /IM mongoose-2.8.exe is not working second time .Please guide me in this respect. Or please tell me is there any other way,to do same thing with python script that will start and kill windows process for my requirement. Regards Bhushan i am getting following error message process cannot acces the file because it is being used by other process -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
__getattribute__ and methods proxying
Hi, I have a class which looks like the one below. What I'm trying to accomplish is to wrap all my method calls and attribute lookups into a proxy method which translates certain exceptions into others. The code below *apparently* works: the original method is called but for some reason the except clause is totally ignored. I thought __getattribute__ was designed for such kind of things (proxying) but apparently it seems I was wrong. class NoSuchProcess(Exception): pass class AccessDenied(Exception): pass class Process(object): def __getattribute__(self, name): # wrap all method calls and attributes lookups so that # underlying OSError exceptions get translated into # NSP and AD exceptions try: print here 1! return object.__getattribute__(self, name) except OSError, err: print here 2! if err.errno == errno.ESRCH: raise NoSuchProcess if err.errno == errno.EPERM: raise AccessDenied def cmdline(self): raise OSError(bla bla) proc = Process() proc.cmdline() --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: __getattribute__ and methods proxying
2010/6/12 David Zaslavsky diaz...@ellipsix.net: Hi, The problem is that when you make this call: proc.cmdline() there are really two steps involved. First you are accessing proc.cmdline, then you are calling it. You could think of it as this: func = proc.cmdline func() __getattribute__ is able to modify how the first step works, but not the second. And it is the second step where the OSError gets raised. You could get around this by returning a wrapper function from __getattribute__, something like this I think: def __getattribute__(self, name): f = object.__getattribute__(self, name) # here you should really check whether it's a function def wrapper(self, *args, **kwargs) print here 1! try: f(*args, **kwargs) except OSError, err: print here 2! if err.errno == errno.ESRCH: raise NoSuchProcess if err.errno == errno.EPERM: raise AccessDenied return wrapper That way func gets set to the wrapper function, which will handle your exception as you want. :) David -- http://mail.python.org/mailman/listinfo/python-list Clear, thanks. Isn't there a prettier/common way to do this? A __methodcall__(self, method_obj) special method or something? Has something like that ever been proposed for inclusion? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: simple chat server
In every dispatcher instance of your application I recommend to override handle_error as follows: class A(asyncore.dispatcher) def handle_error(self): raise This will print a common traceback message instead of the compact one provided by asyncore which provides a lot less information. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/6/11 Burakk burak.kuyuca...@gmail.com: Hi, I am using ubuntu lucid and i have started to learn python(vrs 3.1). I am trying to make a tutorial code(see below) work but when i run the code, open a terminal window and connect as client with telnet and type somethings and hit enter, give me error below...(the terminal says connection closed by foreign host) if someone can help i will be glad... thanx -- error: uncaptured python exception, closing channel __main__.ChatSession connected 127.0.0.1:46654 at 0xb71cce8c (class 'TypeError':expected an object with the buffer interface [/usr/lib/ python3.1/asyncore.py|read|75] [/usr/lib/python3.1/asyncore.py| handle_read_event|420] [/usr/lib/python3.1/asynchat.py|handle_read| 170]) -- code from asyncore import dispatcher from asynchat import async_chat import asyncore import socket PORT = 5005 NAME = 'TestChat' class ChatSession(async_chat): def __init__(self, sock): async_chat.__init__(self, sock) self.set_terminator(xx) self.data = [] def collect_incoming_data(self, data): self.data.append(data) def found_terminator(self): line = ''.join(self.data) self.data = [] self.push(line) class ChatServer(dispatcher): def __init__(self, port): dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(('', PORT)) self.listen(5) self.sessions = [] def handle_accept(self): conn, addr = self.accept() self.sessions.append(ChatSession(conn)) if __name__== '__main__': s = ChatServer(PORT) try: asyncore.loop() except KeyboardInterrupt : print -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: How to read source code of python?
2010/6/10 Leon qjing...@gmail.com: Hi, there, I'm trying to read the source code of python. I read around, and am kind of lost, so where to start? Any comments are welcomed, thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list If you're interested in understanding Python internals you might want to take a look at this: http://tech.blog.aknin.name/category/my-projects/pythons-innards/ --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Jobs
This is an interesting subject. - Your location - country, state or city, whatever you care to provide Turin, Italy - Your focus - Product Development (web sites/apps), Education, RD/Science, IT/Sys Admin, etc Web development based on Zope, Grok and Plone - Your company size Small. - Your compensation relative to the .NET/Java developers you know - generally higher/lower? I would say it's the same. Maybe a little higher but I'm talking about nuts. In my area (Denver, CO) I predominantly see Java positions, followed closely by .NET. I'll occasionally see something pop up related to PHP or Ruby web development but hardly ever Python, so I'm just curious if I'm looking in the wrong places. As for Italy I would say that Java PHP and NET are the most requested positions, half of which I would personally discard because I know I would end up doing something not funny. Python covers a quite relatively small niche. In my city I'm aware of only 4 companies which actively work with Python, mine included. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/6/9 Michael Chambliss em...@mchambliss.com: I use Python for my own entertainment and for quick jobs, but haven't been able to use it professionally up to this point. As a former Perl developer and someone that's currently required to code in Java I'm starting to wish I had this opportunity. Can anyone comment on the Python job market? If you're currently employed writing Python apps, I'd be particularly interested in knowing any of the following: - Your location - country, state or city, whatever you care to provide - Your focus - Product Development (web sites/apps), Education, RD/Science, IT/Sys Admin, etc - Your company size - Your compensation relative to the .NET/Java developers you know - generally higher/lower? In my area (Denver, CO) I predominantly see Java positions, followed closely by .NET. I'll occasionally see something pop up related to PHP or Ruby web development but hardly ever Python, so I'm just curious if I'm looking in the wrong places. Thanks for any input! -Mike -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Sniffer Linux with Raw Socket
RAW sockets are not recommended for doing such kind of things. It is a lot easier and portable using libpcap. Python has a lot of libpcap bindings you can use (pcapy, pypcap, etc...). Just google for it. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/6/6 castor91 casto...@gmail.com: Hi all, i try to make a python sniffer for linux using raw socket and not pcap or scapy.. But i have a lot of problems.. I use the code that i found here: http://docs.python.org/library/socket.html import socket # the public network interface HOST = socket.gethostbyname(socket.gethostname()) # create a raw socket and bind it to the public interface s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) s.bind((HOST, 0)) # Include IP headers s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) # receive all packages s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON) # receive a package print s.recvfrom(65565) # disabled promiscuous mode s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF) but the attribute ioctl is only for windows platform... and also i must replace socket.IPPROTO_IP with 9 because it doesn't work ( i found the answer in a web topic) How do i ??? Thanks and sorry for bad english. --castor91 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Like __getattr__ but with args and kwargs as well
I know, the title doesn't say much, but I had no better ideas. =) I have a class within a serie of redundant methods, which looks like this: class MixedAuthorizer: def __init__(self, *args): # expected a list of class instances self.authorizers = args def get_home(self, user): for auth in self.authorizers: if not auth.has_user(user): continue return auth.get_home(user) return def get_password(self, user): for auth in self.authorizers: if not auth.has_user(user): continue return auth.get_password(user) return # follows a long list of get_* methods as above ... Considering that I always do the same thing (iterate over a list of objects - call obj.has_user() - call obj.get_*()) I would like to know if there's a more compact way to do that. What I basically need is something like __getattr__ but which provides the arguments and eventually the keyword arguments a method has been called with, other than just its name. Actually I'm not even sure whether Python can reach such a level of dynamism but I wanted to give it a try anyway. Is there a way to do such a thing? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Like __getattr__ but with args and kwargs as well
2010/5/28 Peter Otten __pete...@web.de: Giampaolo Rodolà wrote: I know, the title doesn't say much, but I had no better ideas. =) I have a class within a serie of redundant methods, which looks like this: class MixedAuthorizer: def __init__(self, *args): # expected a list of class instances self.authorizers = args def get_home(self, user): for auth in self.authorizers: if not auth.has_user(user): continue return auth.get_home(user) return def get_password(self, user): for auth in self.authorizers: if not auth.has_user(user): continue return auth.get_password(user) return # follows a long list of get_* methods as above ... Considering that I always do the same thing (iterate over a list of objects - call obj.has_user() - call obj.get_*()) I would like to know if there's a more compact way to do that. What I basically need is something like __getattr__ but which provides the arguments and eventually the keyword arguments a method has been called with, other than just its name. Actually I'm not even sure whether Python can reach such a level of dynamism but I wanted to give it a try anyway. Is there a way to do such a thing? Yes, and for the above example it is easier to implement than you think: class MA(object): def __init__(self, authorizers): self.authorizers = authorizers def __getattr__(self, name): def get(self, user): for auth in self.authorizers: if auth.has_user(user): return getattr(auth, name)(user) return get.__get__(self) You can modify it to pass along arbitrary keyword arguments: class MA(object): def __init__(self, authorizers): self.authorizers = authorizers def __getattr__(self, name): def get(self, **kw): for auth in self.authorizers: if auth.has_user(kw[user]): return getattr(auth, name)(**kw) return get.__get__(self) Peter -- http://mail.python.org/mailman/listinfo/python-list Thanks, this has been helpful. I managed to write this monster: =) class MixedAuthorizer(object): def __init__(self, *authorizers): self.authorizers = authorizers def __getattr__(self, name): def get(self, user, *args, **kwargs): for auth in self.authorizers: if auth.has_user(user): method = getattr(auth, name) return method(user, *args, **kwargs) # if we reached this point no user was found if name == validate_authentication: return False if name.startswith(get): return if name.startswith(has): return False return get.__get__(self) --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: asyncore loop and cmdloop problem
2010/5/25 Michele Simionato michele.simion...@gmail.com: On May 25, 10:42 am, kak...@gmail.com kak...@gmail.com wrote: Hi to all, i'm creating a command line application using asyncore and cmd. At if __name__ == '__main__': import socket args = sys.argv[1:] if not args: print Usage: %s querystring % sys.argv[0] sys.exit(0) address = ('localhost', 0) # let the kernel give us a port server = EchoServer(address) ip, port = server.address # find out what port we were given asyncore.loop() CmdClass().cmdloop() what i want is that the above commands asyncore.loop() and CmdClass().cmdloop() running at the same time. Meaning that while the application is in cmd mode with the cmdloop(), it is still able to listen for incoming messages? What should i do? thanks in advance A.K. cmd.Cmd is blocking, so the only way it to run the cmdloop in a separated thread. Once for fun I rewrote the cmd module to be non-blocking but if you want to stick with the standard library you need to use a thread. -- http://mail.python.org/mailman/listinfo/python-list Too bad cmdloop() doesn't provide an argument to return immediately. Why don't you submit this patch on the bug tracker? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: asyncore loop and cmdloop problem
2010/5/25 Michele Simionato michele.simion...@gmail.com: On May 25, 12:03 pm, Giampaolo Rodolà g.rod...@gmail.com wrote: Too bad cmdloop() doesn't provide an argument to return immediately. Why don't you submit this patch on the bug tracker? --- Giampaolohttp://code.google.com/p/pyftpdlibhttp://code.google.com/p/psutil Because it is not a bug, cmd was designed to be blocking. It would be a feature request. Sure, a feature request, but it would be nice to have anyway. =) The OP question shown how this can be desirable in certain circumstances.. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Delete files from FTP Server older then 7 days. Using ftputil and ftplib.
2010/5/19 pilgrim773 thomas.fisc...@gmail.com: Hello I am new to Python programming. I need a write a script which will delete files from a FTP server after they have reached a certain age, like 7 days for example. I have prepared this code below, but I get an error message: The system cannot find the path specified: '/test123/*.*' Probably someone can help me further? Thank you in advance! import os, time, ftputil from ftplib import FTP ftp = FTP('127.0.0.1') print Automated FTP Maintainance print 'Logging in.' ftp.login('admin', 'admin') # This is the directory that we want to go to directory = 'test123' print 'Changing to:' + directory ftp.cwd(directory) files = ftp.retrlines('LIST') print 'List of Files:' + files # ftp.remove('LIST') #--- now = time.time() for f in os.listdir(directory): if os.stat(f).st_mtime now - 7 * 86400: if os.directory.isfile(f): os.remove(os.directory.join(directory, f)) #except: #exit (Cannot delete files) #--- print 'Closing FTP connection' ftp.close() -- http://mail.python.org/mailman/listinfo/python-list Instead of parsing the LIST response you can use MDTM command instead (if the server supports it) which returns a standardized time-like response for every file (ftp.sendcmd('MDTM filename')). Alternatively you can do as you're doing now but using MLSD instead of LIST (again, the server must support it). MLSD returns something like this: type=file;size=156;perm=r;modify=20071029155301;unique=801cd2; music.mp3 type=dir;size=0;perm=el;modify=20071127230206;unique=801e33; ebooks type=file;size=211;perm=r;modify=20071103093626;unique=801e32; module.py This would also be a lot cheaper in terms of data exchanged between client and server and hence faster as you proceed per-directory instead of per-file in every directory. Note that if the server is RFC-compliant both MDTM and MLSD times are expressed as GMT times so an extra conversion to your local time may be necessary. Hope this helps, --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Global variables for python applications
2010/5/16 Chris Rebert c...@rebertia.com: On Sun, May 16, 2010 at 10:50 AM, AON LAZIO aonla...@gmail.com wrote: Hi, How can I set up global variables for the entire python applications? Like I can call and set this variables in any .py files. Think of it as a global variable in a single .py file but this is for the entire application. Thankfully, there is no such thing (can you say spaghetti code?). The closest approximation, as I said in my previous reply, is to use the namespace of a designated module for this purpose, and import that module wherever you need to access/modify these superglobal variables. Example: #g.py: #this module exists to hold superglobal vars global1 = foo global2 = bar #elsewhere.py: #this is some other module in the same program import mypackage.g as g print global #1 = , g.global1 print global #2 =, g.global2 g.global1 = baz # modify a superglobal g.global3 = qux # create a new superglobal Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list I agree global variables are evil, but a config.py module within a serie of global constants which are supposed to be shared amongst all other modules is a little less evil, and also a different beast IMO. Even if you use a class to store such data, a global reference to its instance accessible from everywhere must still exist, so the problem basically still stands. I would be interested to know a good practice to solve such a problem. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: open(False) in python3
2010/5/12 Gabriel Genellina gagsl-...@yahoo.com.ar: open() in Python 3 does a lot of things; it's like a mix of codecs.open() + builtin open() + os.fdopen() from 2.x all merged together. It does different things depending on the type and quantity of its arguments, and even returns objects of different types. In particular, open(some_integer) assumes some_integer is a file descriptor and return some variant of file object using the given file descriptor. Interesting. I wasn't aware of this. Is it documented somewhere? --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: unittest basics
There's no reason for such a thing. You can just make import module in your test and if something goes wrong that will be treated as any other test failure. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/5/11 John Maclean jaye...@gmail.com: is there a way to test that a certian library or module is or can be loaded successfully? self.assert('import blah') -- John Maclean MSc. (DIC) BSc. (Hons) Linux Systems and Applications 07739 171 531 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows - select.select, timeout and KeyboardInterrupt
2010/5/7 Antoine Pitrou solip...@pitrou.net: Le Fri, 07 May 2010 21:55:15 +0200, Giampaolo Rodolà a écrit : Of course, but 30 seconds look a little bit too much to me, also because (I might be wrong here) I noticed that a smaller timeout seems to result in better performances. That's probably bogus. Probably, I'll try to write a benchmark script and see what happens. Plus, if scheduled callbacks are ever gonna be added to asyncore we would be forced to lower the default timeout anyway in order to have a decent reactivity. Why? Assuming loop() function does something like this: ... select.select(r, w, e, timeout) scheduler() # checks for scheduled calls to be fired ... ...imagine a case where there's a connection (aka a dispatcher instance) which does not receive or send any data *and* a scheduled call which is supposed to be fired after, say, 5 seconds. The entire loop would hang on select.select() which won't return for 30 seconds because the socket is not ready for reading and/or writing resulting in scheduler() be called too late. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows - select.select, timeout and KeyboardInterrupt
2010/5/8 Antoine Pitrou solip...@pitrou.net: On Sat, 8 May 2010 13:47:53 +0200 Giampaolo Rodolà g.rod...@gmail.com wrote: Assuming loop() function does something like this: ... select.select(r, w, e, timeout) scheduler() # checks for scheduled calls to be fired ... ...imagine a case where there's a connection (aka a dispatcher instance) which does not receive or send any data *and* a scheduled call which is supposed to be fired after, say, 5 seconds. The entire loop would hang on select.select() which won't return for 30 seconds because the socket is not ready for reading and/or writing resulting in scheduler() be called too late. Well, obviously you have to change the timeout based on the delay for the next scheduled call. If your patch doesn't do that, it probably needs fixing :) Regards Antoine. No it doesn't and I didn't consider this solution at the time. Thanks. =) --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows - select.select, timeout and KeyboardInterrupt
You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Actually there's no reason for asyncore to have such a high default timeout (30 seconds). I think this should be signaled on the bug tracker. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil 2010/5/6 Paul Moore p.f.mo...@gmail.com: From a quick experiment, it seems that select.select with a timeout doesn't react to a keyboard interrupt until the timeout expires. Specifically, if I do s = socket.socket() select.select([s], [], [], 30) and then press Ctrl-C, Python waits for the 30 seconds before raising KeyboardInterrupt. Is this a known limitation on Windows? I see no mention of it in the documentation. Assuming it is a known limitation, is there a way round it? (I'm writing a tiny server using asyncore/asynchat, and the delayed response to Ctrl-C is a mild nuisance. Solutions such as use twisted, while probably the sensible option in a wider context, don't really apply here - I need something within the confines of the stdlib if it's to be worth doing). Thanks, Paul -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows - select.select, timeout and KeyboardInterrupt
2010/5/7 Antoine Pitrou solip...@pitrou.net: Le Fri, 07 May 2010 16:36:44 +0200, Giampaolo Rodolà a écrit : You can easily avoid this by setting a lower timeout when calling asyncore.loop(), like 1 second or less (for example, Twisted uses 0.001 secs). Actually there's no reason for asyncore to have such a high default timeout (30 seconds). The reason for a high default timeout would be to avoid waking the CPU and do useless work too often. This is important on laptops and smaller devices, in order to conserve power. Of course, but 30 seconds look a little bit too much to me, also because (I might be wrong here) I noticed that a smaller timeout seems to result in better performances. Plus, if scheduled callbacks are ever gonna be added to asyncore we would be forced to lower the default timeout anyway in order to have a decent reactivity. --- Giampaolo http://code.google.com/p/pyftpdlib http://code.google.com/p/psutil -- http://mail.python.org/mailman/listinfo/python-list
Re: win32 - catch events(wmi?)
Just out of curiosity, is WMI able to list the TCP and UDP connections opened by a process or by the OS? We'll have to do this for psutil (http://code.google.com/p/psutil) and we guess it's not gonna be easy. --- Giampaolo http://code.google.com/p/psutil http://code.google.com/p/pyftpdlib 2010/5/3 Tim Golden m...@timgolden.me.uk: On 03/05/2010 12:02 PM, Richard Lamboj wrote: i want catch the following events: - registry has chanced - file has chanced - outgoing network connection - programm start and i want to be able to allow, or deny this requests. Wow. That's quite a list. To do what you want in general terms, you're into driver-level code which you're really not going to be able to do with Python. Windows does provide certain hooks and events but they're relatively limited. And the final requirement of being able to allow or deny requests is basically what the OS does via security, so to do it yourself would be quite a large task, methinks. In principle, you can use WMI events to track some of the things you've listed. The only one I'd really recommend is program[m] start for which you can see an related example here: http://timgolden.me.uk/python/wmi/cookbook.html#run-notepad-wait-until-it-s-closed-and-then-show-its-text Even there, WMI is polling on your behalf and if programs are spawning fast enough you'll miss one or more events. File monitoring *can* be done with the same sort of technique from within WMI, but don't: it will bring your disk to its knees. Instead, use the file monitoring APIs, such as: http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html#use_readdirectorychanges I'm not aware of any technique for monitoring registry use, altho' a scan of sysinternals (or its ms-owned replacement) might yield something. And I'm not sure exactly what you mean by outgoing network connection: that's really what the Windows firewall is there for. The firewall does have a WMI interface, although at this moment I can't remember where it is, which would enable you to set some things up, but I don't believe it provides an event/callback mechanism. Might be worth Googling to see if I'm wrong. And in all these cases, I'm really only talking about monitoring usage: you can terminate a process once it's open; you can delete a file once it's created; you can (possibly) nobble a socket connection once it's been made, but anything else and you're doing the Operating System's job for it. TJG -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: unit testing
On 3 Ott, 14:37, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Paul Rubin a écrit : brad [EMAIL PROTECTED] writes: Does anyone else feel that unittesting is too much work? Not in general, just the official unittest module for small to medium sized projects? Yeah, unittest is sort of a Java-ism. You might try the newer doctest module instead. Or py.test or nose, which are both more complete than doctest and more pythonics than the unittest module. Very interesting, thank you. This is the first time I heard about py.test so I took a look at what it is: http://codespeak.net/py/dist/test.html http://ianbicking.org/docs/pytest-presentation/pytest-slides.html At a first look it seems very comfortable to me but I noticed that all usage examples shown uses nothing but the assert statement: def test_answer(): assert 42 == 43 What's the equivalent of unittest's assertRaises? In certain situations it is also useful to test wether an exception (along its type) is raised or not. Does py.test support such thing? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and SSL
I heard that python 2.6 will include full server-side SSL support (whatever this means). Is it true? -- http://mail.python.org/mailman/listinfo/python-list
ANN: Python FTP Server library (pyftpdlib) 0.2.0 released
Hi, I'm pleased to announce release 0.2.0 of Python FTP Server library (pyftpdlib). http://code.google.com/p/pyftpdlib/ === About === Python FTP server library provides an high-level portable interface to easily write asynchronous FTP servers with Python. Based on asyncore framework pyftpdlib is actually the most complete RFC959 FTP server implementation available for Python programming language. === Major changes === * Support for FXP, site-to-site transfers. * NAT/Firewall support with PASV (passive) mode connections. * Configurable range of ports to use for passive data transfers. * Per-user messages configurability. * Maximum connections limit. * Per-source-IP limits. * Maximum login attempts limit. A complete list of changes including enhancements and bug fixes is available here: http://code.google.com/p/pyftpdlib/wiki/ReleaseNotes02 === More links: === * Source tarball: http://pyftpdlib.googlecode.com/files/pyftpdlib_0.2.0.tar.gz * Online docs: http://code.google.com/p/pyftpdlib/wiki/Tutorial * FAQs: http://code.google.com/p/pyftpdlib/wiki/FAQ * Roadmap: http://code.google.com/p/pyftpdlib/wiki/Roadmap * Issue tracker: http://code.google.com/p/pyftpdlib/issues/list Thanks, -- Giampaolo Rodola' g.rodola [at] gmail [dot] com -- http://mail.python.org/mailman/listinfo/python-list