ANN: ActivePython 2.7.2.5 is now available
ActiveState is pleased to announce ActivePython 2.7.2.5, a complete, ready-to-install binary distribution of Python 2.7. http://www.activestate.com/activepython/downloads What's New in ActivePython-2.7.2.5 == New Features Upgrades --- - Upgrade to Python 2.7.2 (`release notes http://hg.python.org/cpython/raw-file/eb3c9b74884c/Misc/NEWS`__) - Security upgrade to openssl-0.9.8r - [Windows] Upgrade to PyWin32 CVS snapshot as of 2011-01-16 - Upgrade to pythonselect 1.3 which supports Windows - Upgrade to PyPM 1.3.4: - [Windows] `Bug #89474 http://bugs.activestate.com/show_bug.cgi?id=89474`_: automatically expand %APPDATA%\Python\Scripts - Bug #90382: --no-ignore option to fail immediately for missing packages - Upgraded the following packages: - Distribute-0.6.19 - pip-1.0.1 - virtualenv-1.6.1 Noteworthy Changes Bug Fixes -- - PyPM: - Upgrade to six 1.0.0 - Bug #89540: `uninstall` command now properly removes symlinks - Bug #89648: shebang fixer skips symlinks - Include SQLAlchemy in the private area (pypm/external/{2,3}/sqlalchemy) What is ActivePython? = ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython also includes a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\pypm install numpy [...] C:\python import numpy.linalg See this page for full details: http://docs.activestate.com/activepython/2.7/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the What's New in Python series, Dive into Python, the Python FAQs HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/2.7/ We would welcome any and all feedback to: activepython-feedb...@activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms === ActivePython is available for the following platforms: - Windows (x86 and x64) - Mac OS X (x86 and x86_64; 10.5+) - Linux (x86 and x86_64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar sridharr at activestate.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: ActivePython 2.6.7.20 is now available
ActiveState is pleased to announce ActivePython 2.6.7.20, a complete, ready-to-install binary distribution of Python 2.6. http://www.activestate.com/activepython/downloads What's New in ActivePythonEE-2.6.7.20 = New Features Upgrades --- - Upgrade to Python 2.6.7 (`release notes http://www.python.org/download/releases/2.6.7/NEWS.txt`__) - Upgrade to pythonselect 1.3 which supports Windows - Upgrade to PyPM 1.3.4: - [Windows] `Bug #89474 http://bugs.activestate.com/show_bug.cgi?id=89474`_: automatically expand %APPDATA%\Python\Scripts - Bug #90382: --no-ignore option to fail immediately for missing packages - Upgraded the following packages: - Distribute-0.6.19 - pip-1.0.1 - virtualenv-1.6.1 Noteworthy Changes Bug Fixes -- - PyPM: - Upgrade to six 1.0.0 - Bug #89540: `uninstall` command now properly removes symlinks - Bug #89648: shebang fixer skips symlinks What is ActivePython? = ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython also includes a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\pypm install numpy [...] C:\python import numpy.linalg See this page for full details: http://docs.activestate.com/activepython/2.6/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the What's New in Python series, Dive into Python, the Python FAQs HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/2.6/ We would welcome any and all feedback to: activepython-feedb...@activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms === ActivePython is available for the following platforms: - Windows (x86 and x64) - Mac OS X (x86 and x86_64; 10.5+) - Linux (x86 and x86_64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar sridharr at activestate.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: ActivePython 2.5.6.10 is now available
ActiveState is pleased to announce ActivePython 2.5.6.10, a complete, ready-to-install binary distribution of Python 2.5. http://www.activestate.com/activepython/downloads What's New in ActivePython-2.5.6.10 === New Features Upgrades --- - Upgrade to Python 2.5.6 (`release notes http://www.python.org/download/releases/2.5.6/NEWS.txt`__) - Upgrade to Tcl/Tk 8.5.9 (`changes http://wiki.tcl.tk/26961`_) - [Windows] Installer upgrade: automatically uninstall previous versions - Bug #87783 - [Linux] Include Tcl/Tk development files (`#40`_) - [Windows] Upgrade to PyWin32 CVS snapshot as of 2011-01-16 - Security upgrade to openssl-0.9.8r Noteworthy Changes Bug Fixes -- - [MacOSX] Fix uninstall on Snow Leopard (10.6) - Bug #87600: create a `idleX.Y` script on unix - [Windows] Renamed python25.exe to python2.5.exe (Unix like) - [Windows] Include python2.exe What is ActivePython? = ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython also includes a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\pypm install numpy [...] C:\python import numpy.linalg See this page for full details: http://docs.activestate.com/activepython/2.5/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the What's New in Python series, Dive into Python, the Python FAQs HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/2.5/ We would welcome any and all feedback to: activepython-feedb...@activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms === ActivePython is available for the following platforms: - Windows (x86 and x64) - Mac OS X (x86 and x86_64; 10.5+) - Linux (x86 and x86_64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit) (Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar sridharr at activestate.com -- 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-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
pytest-2.1.0: perfected assertions/bug fixes
Welcome to the relase of pytest-2.1, a mature testing tool for Python, supporting CPython 2.4-3.2, Jython and latest PyPy interpreters. See the improved extensive docs (now also as PDF!) with tested examples here: http://pytest.org/ The single biggest news about this release are **perfected assertions** courtesy of Benjamin Peterson. You can now safely use ``assert`` statements in test modules without having to worry about side effects or python optimization (-OO) options. This is achieved by rewriting assert statements in test modules upon import, using a PEP302 hook. See http://pytest.org/assert.html#advanced-assertion-introspection for detailed information. The work has been partly sponsored by my company, merlinux GmbH. For further details on bug fixes and smaller enhancements see below. If you want to install or upgrade pytest, just type one of:: pip install -U pytest # or easy_install -U pytest best, holger krekel / http://merlinux.eu Changes between 2.0.3 and 2.1.0 -- - fix issue53 call nosestyle setup functions with correct ordering - fix issue58 and issue59: new assertion code fixes - merge Benjamin's assertionrewrite branch: now assertions for test modules on python 2.6 and above are done by rewriting the AST and saving the pyc file before the test module is imported. see doc/assert.txt for more info. - fix issue43: improve doctests with better traceback reporting on unexpected exceptions - fix issue47: timing output in junitxml for test cases is now correct - fix issue48: typo in MarkInfo repr leading to exception - fix issue49: avoid confusing error when initizaliation partially fails - fix issue44: env/username expansion for junitxml file path - show releaselevel information in test runs for pypy - reworked doc pages for better navigation and PDF generation - report KeyboardInterrupt even if interrupted during session startup - fix issue 35 - provide PDF doc version and download link from index page -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
tox-1.1: bug fixes and improved workflow
Hey all, i just released tox-1.1, the virtualenv/test/CI automation tool. See here for general information and install info: http://codespeak.net/~hpk/tox or http://tox.readthedocs.org (which is missing some navigation links at time of sending email) The release incorporates a number of bug fixes and an enhanced work flow: repeatedly calling tox without increasing version numbers now works (by calling pip -U --nodeps). With this release i consider tox pretty stable and fit for general use. best thanks to all contributors, holger krekel 1.1 - - fix issue5 - don't require argparse for python versions that have it - fix issue6 - recreate virtualenv if installing dependencies failed - fix issue3 - fix example on frontpage - fix issue2 - warn if a test command does not come from the test environment - fixed/enhanced: except for initial install always call -U --no-deps for installing the sdist package to ensure that a package gets upgraded even if its version number did not change. (reported on TIP mailing list and IRC) - inline virtualenv.py (1.6.1) script to avoid a number of issues, particularly failing to install python3 environents from a python2 virtualenv installation. - rework and enhance docs for display on readthedocs.org -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: String concatenation vs. string formatting
On Fri, Jul 8, 2011 at 11:30 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Billy Mays wrote: If it means anything, I think concatenation is faster. You are measuring the speed of an implementation-specific optimization. You'll likely get *very* different results with Jython or IronPython, or old versions of CPython, or even if you use instance attributes instead of local variables. It also doesn't generalise: only appends are optimized, not prepends. Indeed: $ python -m timeit -s v = 'x' * 10; out = '' out = out + v 100 loops, best of 3: 6.59 usec per loop $ python -m timeit -s v = 'x' * 10; out = '' out = v + out 10 loops, best of 3: 268 usec per loop Good to know. I had no idea such an optimization existed. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
On Sat, Jul 9, 2011 at 3:30 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: It also doesn't generalise: only appends are optimized, not prepends. If you're interested in learning about the optimization: http://utcc.utoronto.ca/~cks/space/blog/python/ExaminingStringConcatOpt From that page: Also, this is only for plain (byte) strings, not for Unicode strings; as of Python 2.4.2, Unicode string concatenation remains un-optimized. Has the same optimization been implemented for Unicode? The page doesn't mention Python 3 at all, and I would guess that the realloc optimization would work fine for both types of string. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
On Sat, Jul 9, 2011 at 12:16 AM, Chris Angelico ros...@gmail.com wrote: Has the same optimization been implemented for Unicode? The page doesn't mention Python 3 at all, and I would guess that the realloc optimization would work fine for both types of string. Seems to be implemented for strs in 3.2, but not unicode in 2.7. -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
Andrew Berg bahamutzero8825 at gmail.com writes: Other than the case where a variable isn't a string (format() converts variables to strings, automatically, right?) and when a variable is used a bunch of times, concatenation is fine, but somehow, it seems wrong. Sorry if this seems a bit silly, but I'm a novice when it comes to design. Plus, there's not really supposed to be more than one way to do it in Python. In a logging context at least, using the form like logger.debug(formatting message with %s, arguments) rather than logger.debug(formatting message with %s % arguments) means that the formatting is deferred by logging until it is actually needed. If the message never gets output because of the logging configuration in use, then the formatting is never done. This optimisation won't matter in most cases, but it will in some scenarios. By the way, logging primarily uses %-formatting instead of the newer {}-formatting, because it pre-dates {}-formatting. In more recent versions of Python, all of Python's three formatting styles are supported - see http://plumberjack.blogspot.com/2010/10/supporting-alternative-formatting.html Also by the way - Python doesn't say there shouldn't be more than one way to do things - just that there should be one *obvious* way (from the Zen of Python). Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list
HTTP Proxy : receive call on local socket takes a lot of time
Hi all, I am currently working on a HTTP Proxy. For maximum flexibility, I am implementing the proxy at a low level : I am using the SocketServer library. The server itself is very simple: class MyTCPServer(SocketServer.TCPServer): allow_reuse_address = 1 and the handler looks like: class MyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): # Prints ip and port print \n + str(self.client_address) + requestParser = HTTPRequestParser() while True: # Get packet data = self.request.recv(4096) if data == '': break # Parse request packet if requestParser.got_new_chunk(data): break someStuff = self.request.send(someStuff) This is working fine, but I have a small performance issue. The proxy is targeted by Firefox. Sometimes the first receive call on the input socket takes a lot of time (up to 20s sometimes), which should not be as this is a communication of two local sockets. This is occurring maybe every 30 requests or so. When looking at the logs I noticed that this weird behavior happens when the client port is not contiguous to the previous ones. For example, handling the fourth request takes a lot of time: ('127.0.0.1', 49704) ('127.0.0.1', 49705) ('127.0.0.1', 49706) ('127.0.0.1', 49674) Do you have any idea what the problem could be ? I tried to manually close self.request request, but I still have the problem. Is it related to allow_reuse_address = 1 ? Thanks for your help ! Rémi -- http://mail.python.org/mailman/listinfo/python-list
ctypes: point to buffer in structure
Hey I've been trying to convert this to run through ctypes and i'm having a hard time typedef struct _SYSTEM_PROCESS_ID_INFORMATION { HANDLE ProcessId; UNICODE_STRING ImageName; } SYSTEM_PROCESS_IMAGE_NAME_INFORMATION, *PSYSTEM_PROCESS_IMAGE_NAME_INFORMATION; to class SYSTEM_PROCESS_ID_INFORMATION(ctypes.Structure): _fields_ = [('pid', ctypes.c_ulong), ('imageName', ctypes.c_wchar_p)] processNameBuffer = ctypes.create_unicode_buffer(0x100) pidInfo = SYSTEM_PROCESS_ID_INFORMATION(pid, ctypes.byref(processNameBuffer)) status = ntdll.NtQuerySystemInformation(0x58, ctypes.byref(pidInfo), ctypes.sizeof(pidInfo), None) does anyone know how to get this working? -- http://mail.python.org/mailman/listinfo/python-list
why the following python program does not face any concurrency problems without synchronize mechanism?
from threading import Thread def calc(start, end): total = 0; for i in range(start, end + 1): total += i; print '--result:', total return total t = Thread(target=calc, args=(1,100)) t.start() I have run this program for many times,and the result is always 5050, if there is any concurrency problem, the result should not be 5050, which is never met, anyhow I mean this program should get the wrong answer at some times, but this never happens, why? can concurrency without synchronize mechanism always get the right answer? any special case in python programming? -- http://mail.python.org/mailman/listinfo/python-list
Re: why the following python program does not face any concurrency problems without synchronize mechanism?
On 09.07.2011 22:45, smith jack wrote: from threading import Thread def calc(start, end): total = 0; for i in range(start, end + 1): total += i; print '--result:', total return total t = Thread(target=calc, args=(1,100)) t.start() I have run this program for many times,and the result is always 5050, if there is any concurrency problem, the result should not be 5050, which is never met, anyhow I mean this program should get the wrong answer at some times, but this never happens, why? can concurrency without synchronize mechanism always get the right answer? any special case in python programming? Why do you think, that there's a concurrency problem? All variables are local to the calc() function and all calc() invocations run in an own thread. No thread tries to access any shared data, so why should there be a concurrency problem? Concurrency is an issue, when two or more threads/processes try to access the same data, but in your program everything is local to the calc() function. -- http://mail.python.org/mailman/listinfo/python-list
What makes functions special?
A tracker issue [1] recently got me thinking about what makes functions special. The discussion there was regarding the distinction between compile time (generation of .pyc files for modules and execution of code blocks), [function] definition time, and [function] execution time. Definition time actually happens during compile time, but it has its own label to mark the contrast with execution time. So why do functions get this special treatment? Functions are a special case in Python for providing a more optimized execution of a code block in pure Python code. And how is that? When the function is defined, a code object is generated for the function body along with a few static details that will be used during execution. No other objects have code objects. No other objects in Python have this special optimization. Maybe I am missing something, or maybe it is super obvious, but isn't this a critical point? Is it just a CPython implementation detail that code objects should provide an optimization, or is it a specification of the language? From the docs, the code objects in of function objects are the latter, but the optimization expectation is not clearly indicated. Are there other motivations behind code objects that I am missing? Am I wrong about the optimization expectation? Thoughts? -eric [1] http://bugs.python.org/issue12374 -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
On 2011.07.09 06:06 AM, Vinay Sajip wrote: In a logging context at least, using the form like logger.debug(formatting message with %s, arguments) rather than logger.debug(formatting message with %s % arguments) How would I do that with the newer formatting? I've tried: logger.info('Binary preset file {file} successfully stored.', {file : queue[0].preset_file}) (global name 'file' not defined) and logger.info('Binary preset file {file} successfully stored.', file=queue[0].preset_file) (unexpected keyword 'file') By the way, logging primarily uses %-formatting instead of the newer {}-formatting, because it pre-dates {}-formatting. In more recent versions of Python, all of Python's three formatting styles are supported - see I've noticed. :-) log_formatter = logging.Formatter('{asctime} - __main__ - {funcName} - line {lineno} - {levelname} - {message}', style='{') -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
Eric Snow ericsnowcurren...@gmail.com writes: A tracker issue [1] recently got me thinking about what makes functions special. As you describe, functions are special for your scenario because a function definition needs to result in executable code as an object. Definition time actually happens during compile time, but it has its own label to mark the contrast with execution time. So why do functions get this special treatment? You answer this question. No other objects have code objects. No other objects in Python have this special optimization. Yes. The two facts are directly related. Maybe I am missing something, or maybe it is super obvious, but isn't this a critical point? What is the crisis (“a stark change from one state to another”) that you're referring to by “a critical point”? Yes, functions are different and are treated differently. What's your question? From the docs, the code objects in of function objects are the latter, but the optimization expectation is not clearly indicated. Are there other motivations behind code objects that I am missing? Am I wrong about the optimization expectation? What optimisation expectation? Thoughts? I think yours need to be expressed more explicitly; I'm not seeing the issue that concerns you. -- \“The reason we come up with new versions is not to fix bugs. | `\ It's absolutely not.” —Bill Gates, 1995-10-23 | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
On Sat, Jul 9, 2011 at 4:41 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Eric Snow ericsnowcurren...@gmail.com writes: A tracker issue [1] recently got me thinking about what makes functions special. As you describe, functions are special for your scenario because a function definition needs to result in executable code as an object. Definition time actually happens during compile time, but it has its own label to mark the contrast with execution time. So why do functions get this special treatment? You answer this question. No other objects have code objects. No other objects in Python have this special optimization. Yes. The two facts are directly related. Maybe I am missing something, or maybe it is super obvious, but isn't this a critical point? What is the crisis (“a stark change from one state to another”) that you're referring to by “a critical point”? Yes, functions are different and are treated differently. What's your question? From the docs, the code objects in of function objects are the latter, but the optimization expectation is not clearly indicated. Are there other motivations behind code objects that I am missing? Am I wrong about the optimization expectation? What optimisation expectation? Thoughts? I think yours need to be expressed more explicitly; I'm not seeing the issue that concerns you. My point is that functions are special in Python because they provide a built in optimization via the special execution of code objects. I would like to know if it is really that big a deal, and if the optimized execution of code objects is a CPython implementation detail or a specification of the language. -eric -- \ “The reason we come up with new versions is not to fix bugs. | `\ It's absolutely not.” —Bill Gates, 1995-10-23 | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
On 7/9/2011 2:28 PM, Eric Snow wrote: A tracker issue [1] recently got me thinking about what makes functions special. The discussion there was regarding the distinction between compile time (generation of .pyc files for modules and execution of code blocks), [function] definition time, and [function] execution time. Definition time actually happens during compile time, Not true. For main modules, execution of each statement immediately follows compilation, but not for other modules, where compilation and caching of code objects may happen years before the function object is created. Functions are a special case in Python for providing a more optimized execution of a code block in pure Python code. And how is that? When the function is defined, a code object is generated for the function body along with a few static details that will be used during execution. No other objects have code objects. No other objects in Python have this special optimization. A .pyc file is a serialized code object for a module. As for the rest, I am not sure what you are asking. Terry Reedy -- http://mail.python.org/mailman/listinfo/python-list
How can I make a program automatically run once per day?
I have a script that does some stuff that I want to run every day for maybe a week, or a month. So far I've been good about running it every night, but is there some way (using Python, of course) that I can make it automatically run at a set time each night? -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I make a program automatically run once per day?
On 2011.07.09 07:26 PM, John Salerno wrote: I have a script that does some stuff that I want to run every day for maybe a week, or a month. So far I've been good about running it every night, but is there some way (using Python, of course) that I can make it automatically run at a set time each night? I would use the OS to worry about scheduling (cron/Windows Task Scheduler/whatever), but in Python, you could probably use a while True loop, time.sleep() (to specify how often to check the time) and a datetime.time or datetime.now object (e.g. datetime.now().hour). -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I make a program automatically run once per day?
John Salerno johnj...@gmail.com writes: is there some way (using Python, of course) that I can make it automatically run at a set time each night? You need to use whatever facilities your operating system has for scheduled events. That's unrelated to the language you use for implementing the program. On a Unix-like system (e.g. GNU+Linux), you could create a ‘cron’ job entry. -- \ “The most common way people give up their power is by thinking | `\ they don't have any.” —Alice Walker | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
Eric Snow ericsnowcurren...@gmail.com writes: On Sat, Jul 9, 2011 at 4:41 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Eric Snow ericsnowcurren...@gmail.com writes: No other objects have code objects. No other objects in Python have this special optimization. Yes. The two facts are directly related. […] Yes, functions are different and are treated differently. What's your question? My point is that functions are special in Python because they provide a built in optimization via the special execution of code objects. Functions are special because they define a code object. I would like to know if it is really that big a deal Is *what* really that big a deal? Perhaps this could be clearer if you'd describe what it is that surprises you, and how you'd expect it to be different. and if the optimized execution of code objects is a CPython implementation detail or a specification of the language. I don't know that it's a specification. But functions result in code objects, and other statements don't; I am not seeing why treating them differently is surprising. -- \ “I see little commercial potential for the Internet for at | `\ least ten years.” —Bill Gates, 1994 | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I make a program automatically run once per day?
On 10.07.2011 02:26, John Salerno wrote: I have a script that does some stuff that I want to run every day for maybe a week, or a month. So far I've been good about running it every night, but is there some way (using Python, of course) that I can make it automatically run at a set time each night? Use your operating system's facilities to run timed jobs. Unix/Linux: Cron jobs Windows: Scheduled Tasks Mac: don't know, but probably Cron too -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
On Sat, Jul 9, 2011 at 6:21 PM, Terry Reedy tjre...@udel.edu wrote: On 7/9/2011 2:28 PM, Eric Snow wrote: A tracker issue [1] recently got me thinking about what makes functions special. The discussion there was regarding the distinction between compile time (generation of .pyc files for modules and execution of code blocks), [function] definition time, and [function] execution time. Definition time actually happens during compile time, Not true. For main modules, execution of each statement immediately follows compilation, but not for other modules, where compilation and caching of code objects may happen years before the function object is created. So for non-main modules the function definition happens during module compilation, and for all other code blocks (__main__, exec, etc.) it happens during execution of the code block? Functions are a special case in Python for providing a more optimized execution of a code block in pure Python code. And how is that? When the function is defined, a code object is generated for the function body along with a few static details that will be used during execution. No other objects have code objects. No other objects in Python have this special optimization. A .pyc file is a serialized code object for a module. I hadn't thought of it like that. Nice insight. In that case, do [non-main] module definition and execution time have the same logical separation as function phases do? As for the rest, I am not sure what you are asking. Yeah, I have a real knack for communicating. :) Mostly I am just trying to put together more pieces of the Python puzzle. In this case I was trying to find out if the optimized execution of code objects for functions is a part of the language or just an implementation detail. -eric Terry Reedy -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
On Sat, Jul 9, 2011 at 6:38 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Eric Snow ericsnowcurren...@gmail.com writes: On Sat, Jul 9, 2011 at 4:41 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Eric Snow ericsnowcurren...@gmail.com writes: No other objects have code objects. No other objects in Python have this special optimization. Yes. The two facts are directly related. […] Yes, functions are different and are treated differently. What's your question? My point is that functions are special in Python because they provide a built in optimization via the special execution of code objects. Functions are special because they define a code object. Right. But the point is that the code objects (in CPython at least) allow a special execution of the function body. What does that special execution give us? I am guessing a sufficient performance increase. Is there anything else? And do other Python implementations do anything special with code objects? I am not questioning why it was done a certain way, but rather trying to understand how Python works. I would like to know if it is really that big a deal Is *what* really that big a deal? Perhaps this could be clearer if you'd describe what it is that surprises you, and how you'd expect it to be different. I don't have any unexpected failure that I ran into or anything like that. I am just trying to learn more about the ins and outs of Python and that tracker issue got me thinking. And I know that there are plenty of people on this list that know a lot more about Python than I do. :) So I thought I would ask (in my own obscure way) if I was understanding the definition/execution model correctly. Sorry for any confusion. -eric and if the optimized execution of code objects is a CPython implementation detail or a specification of the language. I don't know that it's a specification. But functions result in code objects, and other statements don't; I am not seeing why treating them differently is surprising. -- \ “I see little commercial potential for the Internet for at | `\ least ten years.” —Bill Gates, 1994 | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
Eric Snow wrote: Mostly I am just trying to put together more pieces of the Python puzzle. In this case I was trying to find out if the optimized execution of code objects for functions is a part of the language or just an implementation detail. You keep using that phrase, optimized execution of code objects for functions, but I have no idea what that means. The best I can think of is that you are thinking along these lines... Suppose we have the source code to a function: def spam(n): return SPAM*n To execute this, Python currently compiles the function into a code block, and then when you call spam(n) elsewhere, Python executes the already compiled code block. Suppose instead an implementation of Python did not pre-compile the function. Each time you called spam(n), the implementation would have to locate the source code and interpret it on the spot. Would that be allowed? If that's your question, then I would call that a Python interpreter using c.1960 technology (as opposed to a byte-code compiler, which all the main implementations currently are). If that were the *only* difference, then I see no reason why it wouldn't be allowed as an implementation of Python. A horribly slow implementation, but still an implementation. However, I doubt that would be the only difference. Given such a simple-minded Python interpreter, it would be hard to provide expected Python language features such as compiled code objects, closures, etc. You would have to fake them somehow. Provided you could fake them sufficiently well, then the lack of a byte-code compiler is just a quality of implementation issue. If that's *not* your question, them I'm stumped. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Newbie help - Programming the Semantic Web with Python
Hello, So, I got this book on Programming the Semantic Web about the same time I started learning Python. The code seems to be developed for python 2.7 and not 3, I believe. The code is here: http://semprog.com/content/the-book/ I tried to run simpletriple.py from inside eclipse with PYDEV. The first thing it has a problem with is this line: def add(self, (sub, pred, obj)): I think the problem is with the parentheses before the sub. I removed those and that seemed to fix that error or make it go away. I don’t remember how I figured that out, It should be on the Errata page for sure. Then it has a problem with this line: print list(g.triples((None, None, None))) If I was using python 3, it would require () around the thing that is going to be printed, right? Maybe python 2.7 doesn’t like this line for the same reason. The book suggests that from IDLE, I can just use from simplegraph import SimpleGraph That means it is going to look for a file named simplegraph.py but where will it be looking? I guess I would have to have it in the same folder as the python interpreter or one of the PATH directories, right? Thanks, Bruce ++ Bruce Whealton, Owner Future Wave Designs FOAF: http://whealton.info/BruceWhealtonJr/foaf.rdf Vcard: http://whealton.info/BruceWhealtonJr/brucewhealtonvcard.html Web Design and Development http://FutureWaveDesigns.com http://futurewavedesigns.com/wordpress/ Web Technology wiki: http://futurewavedesigns.com/w/ ++ wlEmoticon-smile[1].png-- http://mail.python.org/mailman/listinfo/python-list
Re: How can I make a program automatically run once per day?
On 10Jul2011 03:00, Alexander Kapps alex.ka...@web.de wrote: | On 10.07.2011 02:26, John Salerno wrote: | I have a script that does some stuff that I want to run every day for | maybe a week, or a month. So far I've been good about running it every | night, but is there some way (using Python, of course) that I can make | it automatically run at a set time each night? | | Use your operating system's facilities to run timed jobs. | | Unix/Linux: Cron jobs | Windows: Scheduled Tasks | Mac: don't know, but probably Cron too Yep. Macs are UNIX, BSD derived. -- Cameron Simpson c...@zip.com.au DoD#743 http://www.cskk.ezoshosting.com/cs/ USENET: Post to exotic, distant machines. Meet exciting, unusual people. And flame them. - Dan Sorenson, z1...@exnet.iastate.edu, DoD #1066 -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I make a program automatically run once per day?
Thanks everyone! I probably should have said something like Python, if possible and efficient, otherwise any other method ! :) I'll look into the Task Scheduler. Thanks again! -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie help - Programming the Semantic Web with Python
On Sun, Jul 10, 2011 at 11:32 AM, Bruce Whealton br...@whealton.info wrote: problem with is this line: def add(self, (sub, pred, obj)): I think the problem is with the parentheses before the sub. I removed those and that seemed to fix that error or make it go away. I don’t remember how I figured that out, It should be on the Errata page for sure. Then it has a problem with this line: print list(g.triples((None, None, None))) If I was using python 3, it would require () around the thing that is going to be printed, right? Maybe python 2.7 doesn’t like this line for the same reason. The issue there is with tuple unpacking. To match the older syntax, don't touch the call, but change the definition thus: def add(self, args): (sub, pred, obj)=args Or, of course, simply list the arguments directly, rather than in a tuple; but that requires changing every call (if it's a small program that may not be a problem). You're right about needing parentheses around the print() call; in Python 2 it's a statement, but in Python 3, print is a function like any other. Regarding the module search path, this may help: http://docs.python.org/dev/tutorial/modules.html#the-module-search-path Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: CI and BDD with Python
On Jul 8, 9:36 pm, Stefan Behnel stefan...@behnel.de wrote: mark curphey, 09.07.2011 01:41: And for CI having been using Hudson for a while, any real advantages in a Python / Django world for adopting something native like Trac and one of the CI plugins like Bitten? I'm kind'a partial to Morelia for BDD. Don't be fooled by Ruby's RSpec - it's _not_ BDD. In my exalted opinion. BDD means your customer gives you requirements as sentences, and you make them into executable statements. That's what Cucumber does, which Morelia learns from. And BDD and CI are orthogonal. BDD should be part of a complete TDD test suite, and your CI tool should run that. I still like CruiseControl.rb - even though it has bugs when it sees too many git integrations. Hudson had way too many features, and CCrb mildly presumes you know how to operate its .cruise/projects folder manually! -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
On Sat, Jul 9, 2011 at 7:34 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Eric Snow wrote: Mostly I am just trying to put together more pieces of the Python puzzle. In this case I was trying to find out if the optimized execution of code objects for functions is a part of the language or just an implementation detail. You keep using that phrase, optimized execution of code objects for functions, but I have no idea what that means. The best I can think of is that you are thinking along these lines... Suppose we have the source code to a function: def spam(n): return SPAM*n To execute this, Python currently compiles the function into a code block, and then when you call spam(n) elsewhere, Python executes the already compiled code block. Yeah, that's pretty much it. Is that all there is to it? I was saying optimized, but I guess there isn't much special optimization going on then. Thanks for taking the time. -eric Suppose instead an implementation of Python did not pre-compile the function. Each time you called spam(n), the implementation would have to locate the source code and interpret it on the spot. Would that be allowed? If that's your question, then I would call that a Python interpreter using c.1960 technology (as opposed to a byte-code compiler, which all the main implementations currently are). If that were the *only* difference, then I see no reason why it wouldn't be allowed as an implementation of Python. A horribly slow implementation, but still an implementation. However, I doubt that would be the only difference. Given such a simple-minded Python interpreter, it would be hard to provide expected Python language features such as compiled code objects, closures, etc. You would have to fake them somehow. Provided you could fake them sufficiently well, then the lack of a byte-code compiler is just a quality of implementation issue. If that's *not* your question, them I'm stumped. -- Steven -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: CI and BDD with Python
Thanks. FWIW I played with a bunch (Freshen, Morelia, Lettuce) over the last few days and Lettuce appears to be the most actively maintained and closest to a cucumber-like implementation IMHO. I have decided to adopt it for now. I played with a few CI servers but Jenkins (Hudson) is tough to beat IMHO but I am sure this is just my personal preference. Anyways thanks for the help. Cheers, Mark On Jul 9, 2011, at 7:05 PM, Phlip wrote: On Jul 8, 9:36 pm, Stefan Behnel stefan...@behnel.de wrote: mark curphey, 09.07.2011 01:41: And for CI having been using Hudson for a while, any real advantages in a Python / Django world for adopting something native like Trac and one of the CI plugins like Bitten? I'm kind'a partial to Morelia for BDD. Don't be fooled by Ruby's RSpec - it's _not_ BDD. In my exalted opinion. BDD means your customer gives you requirements as sentences, and you make them into executable statements. That's what Cucumber does, which Morelia learns from. And BDD and CI are orthogonal. BDD should be part of a complete TDD test suite, and your CI tool should run that. I still like CruiseControl.rb - even though it has bugs when it sees too many git integrations. Hudson had way too many features, and CCrb mildly presumes you know how to operate its .cruise/projects folder manually! -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie help - Programming the Semantic Web with Python
On 2011.07.09 08:32 PM, Bruce Whealton wrote: Hello, So, I got this book on Programming the Semantic Web about the same time I started learning Python. The code seems to be developed for python 2.7 and not 3, I believe. If you're going to learn Python 3, I suggest learning from a book that deals with Python 3 (if there's not an updated text for the area you're dealing with, go with something that teaches the basics). Once you have the basics down and you know the common differences, then it will be much easier to learn from a text that's based on Python 2 (you'll stumble a whole lot less when trying to learn from such texts). You'll also find some things in Python 3 that have been added to recent versions of Python 2 that the text may not cover (e.g., the old % string formatting syntax vs. the new format() string method). If I was using python 3, it would require () around the thing that is going to be printed, right? That's not really the right way to think of the print() function. The print statement has some very arbitrary syntax that could cause unexpected behavior if simply put in the print() function. The print function has parameters for optional behavior rather than odd syntax. In the simplest cases, print and print() are extremely similar, but print() has a bunch of functionality that is either difficult/annoying to decipher (for humans, not the interpreter) or simply doesn't exist in print. -- http://mail.python.org/mailman/listinfo/python-list
Re: What makes functions special?
On Saturday, July 9, 2011 2:28:58 PM UTC-7, Eric Snow wrote: A tracker issue [1] recently got me thinking about what makes functions special. The discussion there was regarding the distinction between compile time (generation of .pyc files for modules and execution of code blocks), [function] definition time, and [function] execution time. Definition time actually happens during compile time, Nope. Compile time and definition time are always distinct. but it has its own label to mark the contrast with execution time. So why do functions get this special treatment? They don't really. [snip] Am I wrong about the optimization expectation? As best as I can tell, you are asking (in a very opaque way) why the Python compiler even bothers to create code objects, rather than just to create a function object outright, because it doesn't (you think) do that for any other kind of object. Two answers (one general, one specific): 1. You're looking for a pattern where it doesn't make any sense for there to be one. The simple truth of the matter is different syntaxes do different things, and there isn't anything more to it. A lambda expression or def statement does one thing; a different syntax, such as an integer constant, does another thing. Neither one is treated specially; they're just different. Consider another example: tuple syntax versus list syntax. Python will often build the tuple at compile time, but it never builds a list at compile time. Neither one is special; it's just that tuple syntax does one thing, list syntax does a different thing. 2. Now that we've dispensed with the idea that Python is treating functions specially, let's answer your specific question. It's not special, but still, why the code object? The reason, simply, is that code objects are used for more than just functions. Code objects are also used in modules, and in eval and exec statements, and there's one for each statement at the command line. Code objects are also used directly by the interpreter when executing byte code. A function object is only one of several interfaces to a code object. A minor reason is that code objects are constant (in fact, any object that is built at compile time must be a constant). However, function objects are mutable. I hope that helps clear things up. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: CI and BDD with Python
On Jul 9, 7:39 pm, mark curphey m...@curphey.com wrote: Thanks. FWIW I played with a bunch (Freshen, Morelia, Lettuce) Morelia is undermaintained because it's finished. It attaches to any pre-existing TestCase-style test runner, hence there's nothing to maintain! Packages like Lettuce rebuild the entire TestCase back-end just to change the front end. That forces its maintainer to then do the Red Queen thing, and constantly compete with all other test runners just to stay in place. Props for the effort, though..! -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.09 09:54 PM, Dennis Lee Bieber wrote: file is a built-in (related to open). It is? What is it? type(file) Traceback (most recent call last): File stdin, line 1, in module NameError: name 'file' is not defined I don't see it in the docs as a built-in function, constant or type. - -- CPython 3.2 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAwAGBQJOGRszAAoJEPiOA0Bgp4/LAG4H/23ZZZWTEVUWDtFb28JtVKnq oIQG3aKGxHTUrvUgZqRge6KbpYhDtZFNXcknPmC6rXjVFTBb6Ag5eOCVbEq1Nu5t Ahonxy9Mr+a5URe+E4oeLvjp0ascLs2NuGxY35QFGm16jRehZ5egCnhvpMOaa1lp q+VbKWIms2xNw4eyYVfGhfGNvBJ0RXDqHfHKjPwA+oDuUNpFeTRGLrBx9T4qazw5 2+P6fmz6Y8oV3Tu9PQe8L7qksV/NrLe4rG8+sxhlpfzqTGisfKbIsYodo1uUgcdc 723hnkxz1Nh3VmUrB+JTYwYz1mD0ndHMJpkNc4JGBEoxp2lSMk1LE+1+tAlA7b4= =Gd/f -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I make a program automatically run once per day?
On Sat, Jul 9, 2011 at 6:58 PM, Cameron Simpson c...@zip.com.au wrote: On 10Jul2011 03:00, Alexander Kapps alex.ka...@web.de wrote: | On 10.07.2011 02:26, John Salerno wrote: | I have a script that does some stuff that I want to run every day for | maybe a week, or a month. So far I've been good about running it every | night, but is there some way (using Python, of course) that I can make | it automatically run at a set time each night? | | Use your operating system's facilities to run timed jobs. | | Unix/Linux: Cron jobs | Windows: Scheduled Tasks | Mac: don't know, but probably Cron too Yep. Macs are UNIX, BSD derived. Macs have Cron, but Apple's trying to switch away from it. They wrote their own framework to replace the various process-launching programs called launchd. It uses a pretty simple XML config file to launch programs either at startup (replacing init) or on an schedule (replacing cron). -- http://mail.python.org/mailman/listinfo/python-list
Morelia for BDD in Python (was: CI and BDD with Python)
Phlip phlip2...@gmail.com writes: On Jul 9, 7:39 pm, mark curphey m...@curphey.com wrote: Thanks. FWIW I played with a bunch (Freshen, Morelia, Lettuce) Morelia is undermaintained because it's finished. It attaches to any pre-existing TestCase-style test runner, hence there's nothing to maintain! It looks good! But it's not yet in Debian :-( I've filed bug report #633411 URL:http://bugs.debian.org/633411 to call for an interested Python programmer to package it for Debian. -- \“That's the essence of science: Ask an impertinent question, | `\and you're on the way to the pertinent answer.” —Jacob | _o__)Boronowski, _The Ascent of Man_, 1976 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.09 09:54 PM, Dennis Lee Bieber wrote: file is a built-in (related to open). Also: Traceback (most recent call last): File C:\Users\Bahamut\workspace\Disillusion\disillusion.py, line 178, in module save_preset() File C:\Users\Bahamut\workspace\Disillusion\disillusion.py, line 169, in save_preset logger.info('Binary preset file {barf} successfully stored.', barf=queue[0].preset_file) File C:\Python32\lib\logging\__init__.py, line 1229, in info self._log(INFO, msg, args, **kwargs) TypeError: _log() got an unexpected keyword argument 'barf' Is barf built-in as well? - -- CPython 3.2 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAwAGBQJOGSTlAAoJEPiOA0Bgp4/LfbgH/0yo5BegsXcqu3ZTyn3Src+k RJBwnIZNBOpaUS2oogiD8eILF5JonCvztKn6rPuB8uhMWzOKl+jTwf5Y4y2Y+kJ7 37v3d41Bar1vAPQ42vKSqYkQ+p1ZHG5VMjkTFH76g8Q1a82oUMTNucqIXu84an2K 8sZA223ZZqzKa7VTzxr59TNX+4EnUIoBBZGH8LATAp9ILa0cNj/TJm7UOQmRAWzC He2zkhrAERbKm9w0BR/Y9JidJ5BlgdkqY7/yNbaYucAm8aI5xgHYvqt7SrSnSFu8 3X7HBxWz2Kinanvlpb5zZEnBmESrR+PujZqS89Bo/uznipkmgZNdXYPyhO/Rbzk= =QkWp -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: String concatenation vs. string formatting
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.09 11:04 PM, Andrew Berg wrote: Is barf built-in as well? That came off more hostile than I wanted, so I'll rephrase it: I doubt it has anything to do with built-ins, since it fails on a variable name that obviously does not reference a built-in. - -- CPython 3.2 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAwAGBQJOGTBOAAoJEPiOA0Bgp4/LbkcH/2GdaIXnTRbfs4/aZInlf2sJ CK3rxb5OVY2Xz8rWVyHSd5tLRcCV8+R8+Mvv0/Ho6ckZjVi3xi6LHvoVFnhUP5Iv wayXHIJEjrN2oU5DJCSBbKGdtxjAMg48UUe6c2d4UUnV05bFX31SnHfI6Jq13uhs RpLSS3vELl/XDrcNGzMpOP1z8NYt7KpwHWoAWwN2wSZ8SQnyJFcFqbapWxA165Lp btDz1ufJ0nO/td+28y8FELoAkDtwrSBHCPqokbURA6zXy7KmVeGH9nVRO08Lz5ez qRII3lTBzeI9E2X/CUMOwrfLiWYDYYvh6VWBJZifBe5B4PQe/ksVe586A1LHetM= =5Xeo -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Morelia for BDD in Python (was: CI and BDD with Python)
On Jul 9, 8:38 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Phlip phlip2...@gmail.com writes: On Jul 9, 7:39 pm, mark curphey m...@curphey.com wrote: Thanks. FWIW I played with a bunch (Freshen, Morelia, Lettuce) Morelia is undermaintained because it's finished. It attaches to any pre-existing TestCase-style test runner, hence there's nothing to maintain! It looks good! But it's not yet in Debian :-( Tx - I never added anything to a distro before! But..! 'sudo pip install morelia' just worked for me, on Ubuntu. I don't think a python-morelia aptitude package would add any value. Such test rigs shall never have any embedded C code or other shenanigans. If I needed to think of a feature to add, it would be Pname notation in the regular expressions, to then enforce the names of the matching arguments. But this is fluff; real programmers can do without it. If I worked closer to the center of the BDD thought leadership I'd know what else to add... -- http://mail.python.org/mailman/listinfo/python-list
Re: Morelia for BDD in Python (was: CI and BDD with Python)
-- \ “That's the essence of science: Ask an impertinent question, | `\ and you're on the way to the pertinent answer.” —Jacob | _o__) Boronowski, _The Ascent of Man_, 1976 | Ben Finney That nose keeps reminding me of the start of one of the Pirates of the Caribbean movies... -- http://mail.python.org/mailman/listinfo/python-list
Re: Morelia for BDD in Python
Phlip phlip2...@gmail.com writes: 'sudo pip install morelia' just worked for me, on Ubuntu. The problem with ‘pip’ is that it's a parallel package installation that ignores the available package management system on the OS. That's not a fault of ‘pip’ or Setuptools or PyPI or the rest; but it's a higher maintenance burden for the user than getting a package from the same system that provides all the rest of their packages on the computer. On operating systems with poor package management, Python's distutils and PyPI etc. are better than nothing. But on an OS like Debian with good package management already for free software, it's a step backward to rely on external dependencies from a disjoint package system. I don't think a python-morelia aptitude package would add any value. I think it would add great value, since without it I'm unlikely to bother using Morelia in any project. The maintenance burden is too high to keep adding dependencies that come from a distinct dependency system outside my OS. -- \“Consider the daffodil. And while you're doing that, I'll be | `\ over here, looking through your stuff.” —Jack Handey | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
[issue7229] Manual entry for time.daylight can be misleading
Changes by Kenyon Ralph ken...@kenyonralph.com: -- nosy: +kralph ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7229 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12470] Fix cutpaste typo in test_shutil
Roundup Robot devnull@devnull added the comment: New changeset f92bf428c647 by Senthil Kumaran in branch '3.2': Fix closes issue issue12470 - check for utime for the skipUnless condition. http://hg.python.org/cpython/rev/f92bf428c647 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12470 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12438] IDLE problem displaying warning message
Roundup Robot devnull@devnull added the comment: New changeset 7dd9313c300b by Senthil Kumaran in branch '3.2': Fix closes issue12438 - idlelib.PyShell's showformatwarning method was passing an incorrect arg. http://hg.python.org/cpython/rev/7dd9313c300b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12438 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12429] test_io.check_interrupted_write() sporadic failures on FreeBSD 6 on Python 2.7/3.2
Roundup Robot devnull@devnull added the comment: New changeset ad16e4a0ef80 by Victor Stinner in branch '3.2': Issue #12429: Skip interrupted write tests on FreeBSD = 7 http://hg.python.org/cpython/rev/ad16e4a0ef80 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12429 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12486] tokenize module should have a unicode API
STINNER Victor victor.stin...@haypocalc.com added the comment: The compiler has a PyCF_SOURCE_IS_UTF8 flag: see compile() builtin. The parser has a flag to ignore the coding cookie: PyPARSE_IGNORE_COOKIE. Patch tokenize to support Unicode is simple: use PyCF_SOURCE_IS_UTF8 and/or PyPARSE_IGNORE_COOKIE flags and encode the strings to UTF-8. Rewrite the parser to work directly on Unicode is much more complex and I don't think that we need that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12486 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12510] IDLE get_the_calltip mishandles raw strings
Ned Deily n...@acm.org added the comment: The problem is easily reproducible. Although it shouldn't give that error (and that can be fixed), it seems to me that IDLE should not be trying to give a calltip in that context. What it is trying to do is display the __doc__ attribute of the string but the __doc__ is really for the str() constructor: 'a'.__doc__ str(string[, encoding[, errors]]) - str\n\nCreate a new string object from the given encoded string.\nencoding defaults to the current default string encoding.\nerrors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. -- nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12510 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12522] Implement `os.startfile` under Linux and Mac
New submission from Ram Rachum cool...@cool-rr.com: I want to use `os.startfile` to open a folder in Explorer/Nautilus/Finder. The documentation says that it's only implemented on Windows: http://docs.python.org/dev/library/os.html#os.startfile See discussion on Python-ideas here: https://groups.google.com/forum/?hl=en#!topic/python-ideas/LL0SavbKrEA Is there a good reason why `os.startfile` is implemented only on Windows? -- components: Library (Lib) messages: 140057 nosy: cool-RR priority: normal severity: normal status: open title: Implement `os.startfile` under Linux and Mac versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12522 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12522] Implement `os.startfile` under Linux and Mac
Ross Lagerwall rosslagerw...@gmail.com added the comment: I think this is a duplicate of #3177. -- nosy: +rosslagerwall resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12522 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3177] implement os.startfile on posix and MacOSX
Ross Lagerwall rosslagerw...@gmail.com added the comment: Closed #12522 as a duplicate. It contains a link to a discussion on python-ideas requesting the feature. -- nosy: +rosslagerwall versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3177] implement os.startfile on posix and MacOSX
Changes by Ram Rachum cool...@cool-rr.com: -- nosy: +cool-RR ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12418] python should inherit the library search path from the compiler for stdlib extensions
Matthias Klose d...@debian.org added the comment: I don't think so. But maybe it would be enough to special case GCC as a unix compiler? At least there are already autoconf checks trying to detect gcc. -- nosy: +doko ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12418 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12326] Linux 3: tests should avoid using sys.platform == 'linux2'
Matthias Klose d...@debian.org added the comment: while this is sorted out, I propose to apply the following workaround not to introduce `linux3', at least for the branches: --- a/configure.in 2011-06-11 17:46:28.0 +0200 +++ b/configure.in 2011-06-19 22:32:05.852934453 +0200 @@ -293,6 +293,7 @@ MACHDEP=$ac_md_system$ac_md_release case $MACHDEP in + linux3) MACHDEP=linux2;; cygwin*) MACHDEP=cygwin;; darwin*) MACHDEP=darwin;; atheos*) MACHDEP=atheos;; -- nosy: +doko versions: +Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12326 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12326] Linux 3: tests should avoid using sys.platform == 'linux2'
Antoine Pitrou pit...@free.fr added the comment: while this is sorted out, I propose to apply the following workaround not to introduce `linux3', at least for the branches: It's too late, since existing versions won't have the patch and will show linux3 when the kernel gets upgraded. I think we'd better bite the bullet and accept the linux3 value. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12326 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12326] Linux 3: tests should avoid using sys.platform == 'linux2'
Matthias Klose d...@debian.org added the comment: about the plat-*/ files: they are even wrong for some linux architectures, because some constants like the DLFCN constants have different values depending on the platform/architecture (can't find the issue proposing architecture dependent plat-linux2-arch directories). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12326 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12326] Linux 3: tests should avoid using sys.platform == 'linux2'
Roundup Robot devnull@devnull added the comment: New changeset 53d2d30d6ca0 by Antoine Pitrou in branch '2.7': Issue #12326: document the recommended idiom for checking sys.platform on Unix systems. http://hg.python.org/cpython/rev/53d2d30d6ca0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12326 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12326] Linux 3: tests should avoid using sys.platform == 'linux2'
Roundup Robot devnull@devnull added the comment: New changeset 8bc9dbc61ba6 by Antoine Pitrou in branch '3.2': Issue #12326: document the recommended idiom for checking sys.platform on Unix systems. http://hg.python.org/cpython/rev/8bc9dbc61ba6 New changeset 19b3b2d93a63 by Antoine Pitrou in branch 'default': Issue #12326: document the recommended idiom for checking sys.platform on Unix systems. http://hg.python.org/cpython/rev/19b3b2d93a63 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12326 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12519] Call next version 3.3.0
Éric Araujo mer...@netwok.org added the comment: Benjamin committed 2ebcbdca0dee for patchlevel.h, but idlever, distutils.__init__ and others are not edited yet. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12519] Call next version 3.3.0
Benjamin Peterson benja...@python.org added the comment: 2011/7/9 Éric Araujo rep...@bugs.python.org: Éric Araujo mer...@netwok.org added the comment: Benjamin committed 2ebcbdca0dee for patchlevel.h, but idlever, distutils.__init__ and others are not edited yet. I don't care that much. When the tree is bumped to 3.0.0a1, those'll be fixed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12519] Call next version 3.3.0
Éric Araujo mer...@netwok.org added the comment: Then this is done. -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12519 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8639] Allow callable objects in inspect.getargspec
Éric Araujo mer...@netwok.org added the comment: Adding to nosy the developers who last touched inspect. -- nosy: +benjamin.peterson, eric.araujo, michael.foord, ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8639 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8639] Allow callable objects in inspect.getargspec
Changes by Éric Araujo mer...@netwok.org: -- versions: -Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8639 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5420] Queue deprecation warning patch
Éric Araujo mer...@netwok.org added the comment: I think the docstrings of empty and full should mention they’re obsolete, to make users of pydoc or other tools aware of the deprecation before they write code using them. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5420 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11339] annotation for class being defined
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1553375] Add traceback.print_full_exception()
Changes by Éric Araujo mer...@netwok.org: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1553375 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11365] Integrate Buildroot patches (cross-compilation)
Éric Araujo mer...@netwok.org added the comment: No, they’re not the same. See also my listing of (most of the) cross-compile patches: http://mail.python.org/pipermail/python-dev/2011-March/110099.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11365 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Nick Coghlan ncogh...@gmail.com added the comment: Once again got close to committing this, but then realised it is missing all the necessary documentation updates for a core language change. I have uploaded a patch that includes all the changes from Bitbucket as well as the subsequent fixes to avoid modifying sys.stdout when the tests are run and to comply with the whitespace rules set up in the source control hooks (the ACKS, NEWS and a placeholder in whatsnew are also included). What's missing are updates to at least: http://docs.python.org/dev/tutorial/classes.html#generators (a simple example showing delegation should suffice there) http://docs.python.org/dev/reference/simple_stmts.html#the-yield-statement http://docs.python.org/dev/reference/expressions.html#grammar-token-yield_expression http://docs.python.org/dev/reference/simple_stmts.html#the-return-statement (the language reference must be updated for a post PEP 380 world) There are likely other places that should also be updated, but these are the critical ones needed before the patch can be included. -- keywords: +patch nosy: +gcewing Added file: http://bugs.python.org/file22616/pep380-missing-docs.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8639] Allow callable objects in inspect.getargspec
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +durban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8639 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8639] Allow callable objects in inspect.getargspec
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8639 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11339] annotation for class being defined
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294232] Error in metaclass search order
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1294232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5996] abstract class instantiable when subclassing dict
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5996 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12486] tokenize module should have a unicode API
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12486 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10403] Use member consistently
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10403 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12491] Update glossary documentation for the term 'attribute'
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12491 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2377] Replace __import__ w/ importlib.__import__
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2377 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12374] Execution model should explain compile vs definition vs execution time
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12374 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11435] Links to source code should now point to hg repo
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11435 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12523] 'str' object has no attribute 'more' [/usr/lib/python3.2/asynchat.py|initiate_send|245]
New submission from Gry gryll...@gmail.com: Asynchat push() function has a bug which prevents it from functioning. This code worked fine with Python 2. --- # https://github.com/jstoker/BasicBot import asynchat,asyncore,socket class asynchat_bot(asynchat.async_chat): def __init__(self, host, port): asynchat.async_chat.__init__(self) self.create_socket(socket.AF_INET,socket.SOCK_STREAM) self.set_terminator('\r\n') self.data='' self.remote=(host,port) self.connect(self.remote) def handle_connect(self): self.push('USER BasicBot 8 %s :BasicBot! http://github.com/jstoker/BasicBot\r\nNICK testbot\r\n' % self.remote[0]) def get_data(self): r=self.data self.data='' return r def collect_incoming_data(self, data): self.data+=data def found_terminator(self): data=self.get_data() if data[:4] == 'PING': self.push('PONG %s' % data[5:]+'\r\n') if '001' in data: self.push('JOIN #bots\r\n') if '~hi' in data: self.push('PRIVMSG #bots :hi.\r\n') if __name__ == '__main__': asynchat_bot('127.0.0.1',16667) asyncore.loop() --- In Python 3 however, the exception follows: --- ~/tests/BasicBot$ python3 asynchat_bot.py error: uncaptured python exception, closing channel __main__.asynchat_bot connected at 0xb70078ac (class 'AttributeError':'str' object has no attribute 'more' [/usr/lib/python3.2/asyncore.py|write|89] [/usr/lib/python3.2/asyncore.py|handle_write_event|462] [/usr/lib/python3.2/asynchat.py|handle_write|194] [/usr/lib/python3.2/asynchat.py|initiate_send|245]) ~/tests/BasicBot$ python3 -V Python 3.2 ~/tests/BasicBot$ --- A comment from Stackoverflow on why it happens: --- The error seems to be raised in /usr/lib/python3.2/asynchat.py|initiate_send|245. def initiate_send(self): while self.producer_fifo and self.connected: first = self.producer_fifo[0] ... try: data = buffer(first, 0, obs) except TypeError: data = first.more() --- here Seems like somebody put a string in self.producer_fifo instead of an asyncchat.simple_producer, which is the only class in async*.py with a more() method. -- components: None messages: 140073 nosy: Gry priority: normal severity: normal status: open title: 'str' object has no attribute 'more' [/usr/lib/python3.2/asynchat.py|initiate_send|245] type: crash versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12523] 'str' object has no attribute 'more' [/usr/lib/python3.2/asynchat.py|initiate_send|245]
Changes by Jimmy Cao jcao...@gmail.com: -- nosy: +jcao219 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com