[issue18420] os.rename FileNotFound complaining about dst, but it is src which is missing

2013-07-09 Thread Dun Peal
New submission from Dun Peal: # The following reproduction is running on Ubuntu 13.04, Python 3.3.1: $ ls bar $ python3 -c import os; os.rename('foo', 'bar') Traceback (most recent call last): File string, line 1, in module FileNotFoundError: [Errno 2] No such file or directory: 'bar

Function call arguments in stack trace?

2011-06-07 Thread Dun Peal
Hi, In a stack trace, is it possible to somehow get the arguments with which each function was called? So for example, if function `foo` in module `bar` was called with arguments `(1, [2])` when it raised an exception, then instead of: Traceback (most recent call last): File bar.py,

Re: Function call arguments in stack trace?

2011-06-07 Thread Dun Peal
On Jun 7, 1:23 pm, Neil Cerutti ne...@norwich.edu wrote: Use pdb. Neil, thanks for the tip; `pdb` is indeed a great debugging tool. Still, it doesn't obviate the need for arguments in the stack trace. For example: 1) Arguments in stack trace can expedite a debugging session, and even obviate

Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Dun Peal
Hi! Here's the demonstrating code: # module foo.py var = 0 def set(): global var var = 1 Script using this module: import foo from foo import * print var, foo.var set() print var, foo.var Script output: 0 0 0 1 Apparently, the `var`

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Dun Peal
OK, I understand now. `from foo import var` means create a module-global name `var` inside the current module, and have it point at the object `foo.var` is pointing at (following its evaluation). Naturally, regardless of whether `foo.var` ever changes, the global `var` of the current module

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Dun Peal
P.S. now I have to ask: is there a symbolic reference in Python, i.e. a name foo that points to whatever bar.baz is pointing at? Thanks, D. -- http://mail.python.org/mailman/listinfo/python-list

Why doesn't this asyncore.dispatcher.handle_read() get called?

2011-04-20 Thread Dun Peal
Hi, I'm writing and testing an asyncore-based server. Unfortunately, it doesn't seem to work. The code below is based on the official docs and examples, and starts a listening and sending dispatcher, where the sending dispatcher connects and sends a message to the listener - yet

Re: Why doesn't this asyncore.dispatcher.handle_read() get called?

2011-04-20 Thread Dun Peal
On Apr 20, 3:01 pm, Jean-Paul Calderone calderone.jeanp...@gmail.com wrote: You didn't let the program run long enough for the later events to happen.  loop(count=1) basically means one I/O event will be processed - in the case of your example, that's an accept().  Then asyncore is done and it

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-28 Thread Dun Peal
On Wed, Oct 20, 2010 at 6:52 AM, Stefan Behnel stefan...@behnel.de wrote: Well, the estimate is about one man-month, so it would be doable in about three months time if we had the money to work on it. So far, no one has made a serious offer to support that project, though. I find myself

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-19 Thread Dun Peal
On Mon, Oct 18, 2010 at 1:41 AM, Stefan Behnel stefan...@behnel.de wrote: Or, a bit shorter, using Cython 0.13:    def only_allowed_characters(list strings):        cdef unicode s        return any((c 31 or c 127)                   for s in strings for c in s) Very cool, this caused me to

Fastest way to detect a non-ASCII character in a list of strings.

2010-10-17 Thread Dun Peal
`all_ascii(L)` is a function that accepts a list of strings L, and returns True if all of those strings contain only ASCII chars, False otherwise. What's the fastest way to implement `all_ascii(L)`? My ideas so far are: 1. Match against a regexp with a character range: `[ -~]` 2. Use

Re: Best Git library for Python?

2010-10-05 Thread Dun Peal
On Oct 4, 7:23 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: You can already check the exit status from the subprocess. What more do you need? A robust mechanism to deal with said issues... Of course I can write it myself, but it would save much time and effort if I could

Best Git library for Python?

2010-10-04 Thread Dun Peal
Hi folks, I'm writing a Python program to operate on Git repositories. The program works at the user level of abstraction: i.e. it needs to do everything that an end user can do with Git. I'm talking about the high-level commands like git-clone, git-branch, git-fetch, git-merge, git-rebase,

Re: Best Git library for Python?

2010-10-04 Thread Dun Peal
On Oct 4, 4:04 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: Why not just call Git itself? That's what I'm doing right now, but since this is a mission-critical process, it would be nice to have a more reliable exception detection and handling mechanism. With my straight