trouble with cmd.Cmd and prompting

Cameron Simpson cs at zip.com.au
Tue Jan 3 19:20:18 EST 2017


On 03Jan2017 16:57, Peter Otten <__peter__ at web.de> wrote:
>Cameron Simpson wrote:
>> On 03Jan2017 00:14, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>>>On Tue, 3 Jan 2017 11:33:15 +1100, Cameron Simpson <cs at zip.com.au>
>>>declaimed the following:
>>>>I'm using cmd.Cmd to write a little FTP-like command line to interface to
>>>>a storage system of mine and encountering weird behaviour. When I enter a
>>>>command the next prompt appears _before_ the associated operation runs,
[...]
>>>Haven't used the module but there is something I find intriguing in the
>>>help system
>>>-=-=-=-=-
>>> Cmd.precmd(line)
>>>    Hook method executed just before the command line is interpreted, but
>>>after the input prompt is generated and issued.
>>>-=-=-=-=-
>>>"... AFTER the input prompt is ... issued"
[...]
>I don't believe Dennis' reading of the docs is correct, and the relevant
>part of the source (Python 3.4) does not show anything to support it:
[... code that runs as I had imagined ...]
>Is there something asynchronous in your command? Perhaps you can post a
>minimal runnable example that shows the odd behaviour.

In the commands themselves? No, but the storage system has lots of asynchronous 
activity.

I'm bothered by the fact that an empty command also shows this behaviour.

I will try to get a minimal example others can run.

Cheers,
Cameron Simpson <cs at zip.com.au>



More information about the Python-list mailing list