running python program overflows into vim editor itself

5 views
Skip to first unread message

JD Allen

unread,
Apr 25, 2023, 12:02:27 AM4/25/23
to vim_dev
Hi, I am not sure how to reproduce the bug without the whole python file, but here is the order of events:

1. I run my python file from vim with: 
!python %

2. I use the program until it crashes (predictably, due to incomplete code)

3. Instead of the usual message explaining where the error in the file is, it quits directly back to the editor

4. Sometimes, but not always, when it quits like this it seems to "overflow" into the editor and changes the file in some way: It might delete or overwrite a line somewhere in an unpredictable manner

5. If it has changed the file, I have to undo changes to see what and where the change is, in case it has messed up my program somehow

Please let me know if I can post any other details that might help to identify the problem

Thanks

Bram Moolenaar

unread,
Apr 25, 2023, 9:55:36 AM4/25/23
to vim...@googlegroups.com, JD Allen

> Hi, I am not sure how to reproduce the bug without the whole python file,
> but here is the order of events:
>
> 1. I run my python file from vim with:
> !python %

Make sure you put a colon before this. Otherwise you are filtering the
text instead of only running the program.

> 2. I use the program until it crashes (predictably, due to incomplete code)
>
> 3. Instead of the usual message explaining where the error in the file is,
> it quits directly back to the editor
>
> 4. Sometimes, but not always, when it quits like this it seems to
> "overflow" into the editor and changes the file in some way: It might
> delete or overwrite a line somewhere in an unpredictable manner
>
> 5. If it has changed the file, I have to undo changes to see what and where
> the change is, in case it has messed up my program somehow
>
> Please let me know if I can post any other details that might help to
> identify the problem

Try redirecting the output from python to a file. Then you should be
able to see error messages and avoid that Vim might interpret it as
commands.

--
There are two ways of constructing a software design. One way is to make
it so simple that there are obviously no deficiencies. The other way
is to make it so complicated that there are no obvious deficiencies.
-C.A.R. Hoare

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages