On Windows: <Right-Click, Edit In gvim >=> exception creating temp file

15 views
Skip to first unread message

Caomai

unread,
Feb 9, 2010, 1:51:42 PM2/9/10
to leo-editor
I just updated Fedora 11, Windows XP and Windows 7 workstations to
build 2920.

When I <Right-Click, Edit In gvim> on a Headline on the Linux host
gvim is launched and no exception message is logged.

However, when I do the same on both the Windows hosts gvim does NOT
launch and an exception is logged regarding creating the temp file.

I do not have any plugins beyond the "official" ones in leoSettings.py
enabled.

#~#
Leo Log Window
Leo 4.7 beta 3, build 2835, February 2, 2010
Python 3.1.1, qt version 4.6.1
Windows 6, 1, 7600, 2,
leoID=skrivsm (in C:\Users\skrivsm\.leo)
load dir: C:\leo-editor\trunk\leo\core
global config dir: C:\leo-editor\trunk\leo\config
home dir: C:\Users\skrivsm
reading settings in C:\leo-editor\trunk\leo\config\leoSettings.leo
using menus from: leoSettings.leo
reading settings in C:\Users\skrivsm\.leo\myLeoSettings.leo
opening default_leo_file: C:\Users\skrivsm\.leo\workbook.leo
@enabled-plugins found in myLeoSettings.leo
reading: C:\Users\skrivsm\.leo\workbook.leo
creating: newHeadline_LeoTemp_57628720.py
exception creating temp file
Traceback (most recent call last):
File "C:\leo-editor\trunk\leo\core\leoCommands.py", line 1157, in
createOpenWithTempFile
f.write(s)
TypeError: must be str, not bytes
#~#

-Shawn

Caomai

unread,
Feb 9, 2010, 2:50:51 PM2/9/10
to leo-editor

On Feb 9, 12:51 pm, Caomai <shawn.skri...@gmail.com> wrote:
> I just updated Fedora 11, Windows XP and Windows 7 workstations to
> build 2920.
>
> When I <Right-Click, Edit In gvim> on a Headline on the Linux host
> gvim is launched and no exception message is logged.
>
> However, when I do the same on both the Windows hosts gvim does NOT
> launch and an exception is logged regarding creating the temp file.
>
> I do not have any plugins beyond the "official" ones in leoSettings.py
> enabled.
>
> #~#
> Leo Log Window
> Leo 4.7 beta 3, build 2835, February 2, 2010
> Python 3.1.1, qt version 4.6.1
> Windows 6, 1, 7600, 2,

<snip>


> reading: C:\Users\skrivsm\.leo\workbook.leo
> creating:   newHeadline_LeoTemp_57628720.py
> exception creating temp file
> Traceback (most recent call last):
>   File "C:\leo-editor\trunk\leo\core\leoCommands.py", line 1157, in
> createOpenWithTempFile
>     f.write(s)
> TypeError: must be str, not bytes
> #~#


Two significant differences between the Linux and Windows
environments, however, is that on Linux I am using Python 2.6.0 and
and Qt version 4.5.3. Both Windows hosts are using Python 3.1.1 and Qt
version 4.6.1.

My apologies for omitting those details previously!

-Shawn

Edward K. Ream

unread,
Feb 9, 2010, 4:51:24 PM2/9/10
to leo-e...@googlegroups.com
> Two significant differences between the Linux and Windows
> environments, however, is that on Linux I am using Python 2.6.0 and
> and Qt version 4.5.3. Both Windows hosts are using Python 3.1.1 and Qt
> version 4.6.1.
>
> My apologies for omitting those details previously!

No problem. This is one of the standard Python 3.x messages. It
should be easy to fix.

Edward

Edward K. Ream

unread,
Feb 9, 2010, 5:02:01 PM2/9/10
to leo-e...@googlegroups.com
On Tue, Feb 9, 2010 at 3:51 PM, Edward K. Ream <edre...@gmail.com> wrote:

> No problem.  This is one of the standard Python 3.x messages.  It
> should be easy to fix.

Fixed on the trunk at rev 2923. All unit tests pass with Python
2.x/3.x, including a new test of c.createOpenWithTempFile.

Edward

Caomai

unread,
Feb 9, 2010, 7:18:30 PM2/9/10
to leo-editor

On Feb 9, 4:02 pm, "Edward K. Ream" <edream...@gmail.com> wrote:


> On Tue, Feb 9, 2010 at 3:51 PM, Edward K. Ream <edream...@gmail.com> wrote:
>
> > No problem.  This is one of the standard Python 3.x messages.  It
> > should be easy to fix.
>
> Fixed on the trunk at rev 2923.  All unit tests pass with Python
> 2.x/3.x, including a new test of c.createOpenWithTempFile.

I updated on Windows 7 to build 2925 and tried again.

Now a somewhat different error occurs which appears to happen after a
call to the Windows API.
"WindowsError: [Error 2] The system cannot find the file specified"

gvim does not launch in this situation either. gvim is in my system
PATH and can be launched from a standard cmd shell using "gvim"
without preceding path.

# Try: LEO_EDITOR="C:\Program Files (x86)\Vim\vim72\gvim.exe"
Result: "WindowsError: [Error 5] Access is denied."

# Try: LEO_EDITOR=C:\PROGRA~2\Vim\vim72\gvim.exe
Result: Success

# Try: LEO_EDITOR=C:\Program Files (x86)\Vim\vim72\gvim.exe
Result: Success

(Delete LEO_EDITOR variable and leave ONLY the EDITOR one)

#Try: EDITOR=C:\PROGRA~2\Vim\vim72\gvim.exe
Result: Success

#Try: EDITOR=C:\Program Files (x86)\Vim\vim72\gvim.exe
Result: Success

My take on this is that the path+name of the specified editor (in
either LEO_EDITOR or EDITOR) cannot have BLANKS in the path when the
executable needs to be searched for and cannot use QUOTES when
specifying the complete path (which is a common Windows convention for
path+file with blanks).

Below are complete log outputs for the two different errors cited:

#~#


Python 3.1.1, qt version 4.6.1
Windows 6, 1, 7600, 2,

leoID=skrivsm (in C:\Users\skrivsm\.leo)
load dir: C:\leo-editor\trunk\leo\core
global config dir: C:\leo-editor\trunk\leo\config
home dir: C:\Users\skrivsm
reading settings in C:\leo-editor\trunk\leo\config\leoSettings.leo
using menus from: leoSettings.leo
reading settings in C:\Users\skrivsm\.leo\myLeoSettings.leo

opening default_leo_file: C:\Users\skrivsm\.leo\workbook.leo
@enabled-plugins found in myLeoSettings.leo


reading: C:\Users\skrivsm\.leo\workbook.leo

creating: newHeadline_LeoTemp_62387984.py
time: 1265759165.3427734
vtuple ['gvim', 'c:\\users\\skrivsm\\appdata\\local\\temp\
\newHeadline_LeoTemp_62387984.py']


Traceback (most recent call last):

File "C:\leo-editor\trunk\leo\core\leoCommands.py", line 1032, in
openTempFileInExternalEditor
subprocess.Popen(vtuple,shell=use_shell)
File "C:\Python31\lib\subprocess.py", line 646, in __init__
errread, errwrite)
File "C:\Python31\lib\subprocess.py", line 856, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
#~#

#~#
Leo Log Window
Leo 4.7 beta 3, build 2835, February 2, 2010
Python 3.1.1, qt version 4.6.1
Windows 6, 1, 7600, 2,

leoID=skrivsm (in C:\Users\skrivsm\.leo)
load dir: C:\leo-editor\trunk\leo\core
global config dir: C:\leo-editor\trunk\leo\config
home dir: C:\Users\skrivsm
reading settings in C:\leo-editor\trunk\leo\config\leoSettings.leo
using menus from: leoSettings.leo
reading settings in C:\Users\skrivsm\.leo\myLeoSettings.leo

opening default_leo_file: C:\Users\skrivsm\.leo\workbook.leo
@enabled-plugins found in myLeoSettings.leo


reading: C:\Users\skrivsm\.leo\workbook.leo

creating: newHeadline_LeoTemp_56428464.py
time: 1265760609.9824219
vtuple ['"C:\\Program Files (x86)\\Vim\\vim72\\gvim.exe"', 'c:\\users\
\skrivsm\\appdata\\local\\temp\\newHeadline_LeoTemp_56428464.py']


Traceback (most recent call last):

File "C:\leo-editor\trunk\leo\core\leoCommands.py", line 1032, in
openTempFileInExternalEditor
subprocess.Popen(vtuple,shell=use_shell)
File "C:\Python31\lib\subprocess.py", line 646, in __init__
errread, errwrite)
File "C:\Python31\lib\subprocess.py", line 856, in _execute_child
startupinfo)
WindowsError: [Error 5] Access is denied
#~#

-Shawn

Edward K. Ream

unread,
Feb 10, 2010, 8:44:19 AM2/10/10
to leo-e...@googlegroups.com
On Tue, Feb 9, 2010 at 6:18 PM, Caomai <shawn....@gmail.com> wrote:

> Now a somewhat different error occurs which appears to happen after a
> call to the Windows API.
> "WindowsError: [Error 2] The system cannot find the file specified"
>
> gvim does not launch in this situation either. gvim is in my system
> PATH and can be launched from a standard cmd shell using "gvim"
> without preceding path.
>
> # Try: LEO_EDITOR="C:\Program Files (x86)\Vim\vim72\gvim.exe"
> Result: "WindowsError: [Error 5] Access is denied."
>
> # Try: LEO_EDITOR=C:\PROGRA~2\Vim\vim72\gvim.exe
> Result: Success

[snip]

> My take on this is that the path+name of the specified editor (in
> either LEO_EDITOR or EDITOR) cannot have BLANKS in the path when the
> executable needs to be searched for and cannot use QUOTES when
> specifying the complete path (which is a common Windows convention for
> path+file with blanks).

Correct. I'm not sure whether this can be fixed. There are comments
to this effect in c.openTempFileInExternalEditor that pertain to the
'os.system' way of specifying actions. Is this what you are using?
If so, maybe using another way would work.

Or maybe this is just a documentation issue. After all, you have
found ways to get the job done.

Edward

Shawn Skriver

unread,
Feb 10, 2010, 10:58:26 AM2/10/10
to leo-e...@googlegroups.com

IMO, I think that documentation is sufficient. There will always be discrepancies between operating systems. That is why there are POSIX initiatives!

-Shanw

Reply all
Reply to author
Forward
0 new messages