Vim Tips Wiki
(New page: This tip will help resolve the error messages *e97* and *e48[0-9]* which relate to the creation of and or reading of temporary files on machines running MS Windows. *e97* Can't create...)
 
(add some more info and causes)
 
(20 intermediate revisions by 7 users not shown)
Line 1: Line 1:
  +
{{TipNew
This tip will help resolve the error messages *e97* and
 
  +
|id=1532
  +
|previous=1531
  +
|next=1533
  +
|created=November 13, 2007
  +
|complexity=basic
  +
|author=[[User:corp-mule|corp-mule]]
  +
|version=7.0
  +
|subpage=/200712
  +
|category1=
  +
|category2=
  +
}}
  +
This tip will help resolve error messages E97, E483, E484, E485, and E810 encountered on machines running MS Windows. These errors relate to the creation of, or reading of temporary files. See {{help|E97}}, {{help|E483}}, {{help|E485}}. Also see [[VimTip416|Fix error E97 Cannot create diffs under Windows]].
   
  +
<pre>
*e48[0-9]* which relate to the creation of and or reading of
 
 
*e97* Can't create diffs blah blah
 
*e485* Can't read file blah blah
  +
</pre>
   
 
I've experienced these errors when trying to use the diff commands, or any shell commands being called via the :! or :r! commands.
temporary files on machines running MS Windows.
 
   
  +
That is,
  +
<pre>
 
:r! sort blah blah blah %
 
or
 
:r! dir
 
etc
  +
</pre>
   
  +
==Generic causes==
*e97* Can't create diffs blah blah
 
   
  +
To correct this problem you may need to change your environment variable for $TMP or $TEMP, to somewhere you have write access. You can do this in a couple of different ways.
*e485* Can't read file blah blah
 
   
  +
<pre>
 
1. Use the Windows environment settings. Here is one method.
 
- Right click "My Computer".
 
- Choose "Properties".
 
- Click the "Advanced" tab.
 
- Click the "Environment Variables" button.
 
- In the bottom window pane, scroll down to the TMP or
 
TEMP variables and highlight them.
 
- Then click the "Edit" button and change the path to
  +
the directory you want.
 
2. Use Vim &ndash; much better!
 
- Add the following to your _vimrc file:
 
let $TMP="c:/tmp"
  +
</pre>
   
  +
In both cases, you need to create the directory (for example, C:\tmp), and you need read and write permission in that directory.
I've experienced these errors when trying to use the diff
 
   
  +
Another possible cause, as mentioned at {{help|E484}} starting with Vim 7.3.845, is bad escaping of shell commands. If you have any special characters in an external command, such as any of the characters <code>^&|<>()</code> or space characters, you will probably need to escape them with the shellescape() function before passing them to an external command.
commands or, any shell commands being called via the :! or
 
   
  +
==E303==
:r! commands.
 
  +
A common cause for the specific E303 error on recent versions of Windows, is that Microsoft at some point moved the default value of %TEMP% and %TMP% to reside somewhere deep within the current user's home directory, and removed the previous default directory C:\Temp and C:\TMP. For some reason, Vim doesn't (as of 2013-03-07) use $TEMP or $TMP for the default value of the {{help|prefix=no|'directory'}} option. Fixing this is easy, just put this in your .vimrc:
   
  +
<code>
  +
set directory=.,$TMP,$TEMP
  +
</code>
   
  +
See http://code.google.com/p/vim/issues/detail?id=28 for current status of this issue.
i.e.,
 
   
  +
==Comments==
 
  +
{{Todo}}
:r! sort blah blah blah %
 
  +
*This tip needs reworking. A reader could get the impression that the only cause for the specified errors is due to TMP.
 
  +
*Add a brief explanation of what the environment variables do.
 
  +
*Probably want reference to {{help|dos-temp-files}}. Any others?
or
 
  +
*The title is not helpful because a reader would only search for this title if they already knew the cause of their problem.
 
:r! dir
 
 
 
etc.
 
 
 
To correct this problem you need to change your environment
 
 
variable for $TMP, or $TEMP. You can do this in a couple of
 
 
different ways.
 
 
 
 
 
1. Via the Windows environment settings ...
 
 
 
- There's more than one way to do this and here's one
 
 
of 'em
 
 
 
- Right click "My Computer"
 
 
- Choose "Properties"
 
 
- Click the "Advanced" tab
 
 
- Click the "Environment Variables" button
 
 
- In the bottom window pane, scroll down to the TMP or
 
 
TEMP variables and highlight them.
 
 
- Then click the "Edit" button and change it path to
 
 
whatever directory you have read and write
 
 
priviledges to.
 
 
 
2. A much better way!
 
 
- Add the following to your _vimrc file
 
 
 
 
let $TMP="c:/tmp"
 
 
 
 
- Create the path first
 
 
 
I hope this helps resolve the issue for you.
 
 
- corp-mule
 

Latest revision as of 18:26, 7 March 2013

Tip 1532 Printable Monobook Previous Next

created November 13, 2007 · complexity basic · author corp-mule · version 7.0


This tip will help resolve error messages E97, E483, E484, E485, and E810 encountered on machines running MS Windows. These errors relate to the creation of, or reading of temporary files. See :help E97, :help E483, :help E485. Also see Fix error E97 Cannot create diffs under Windows.

*e97* Can't create diffs blah blah
*e485* Can't read file blah blah

I've experienced these errors when trying to use the diff commands, or any shell commands being called via the :! or :r! commands.

That is,

:r! sort blah blah blah %
or
:r! dir
etc

Generic causes[]

To correct this problem you may need to change your environment variable for $TMP or $TEMP, to somewhere you have write access. You can do this in a couple of different ways.

1. Use the Windows environment settings. Here is one method.
    - Right click "My Computer".
    - Choose "Properties".
    - Click the "Advanced" tab.
    - Click the "Environment Variables" button.
    - In the bottom window pane, scroll down to the TMP or
      TEMP variables and highlight them.
    - Then click the "Edit" button and change the path to
      the directory you want.
2. Use Vim – much better!
    - Add the following to your _vimrc file:
      let $TMP="c:/tmp"

In both cases, you need to create the directory (for example, C:\tmp), and you need read and write permission in that directory.

Another possible cause, as mentioned at :help E484 starting with Vim 7.3.845, is bad escaping of shell commands. If you have any special characters in an external command, such as any of the characters ^&|<>() or space characters, you will probably need to escape them with the shellescape() function before passing them to an external command.

E303[]

A common cause for the specific E303 error on recent versions of Windows, is that Microsoft at some point moved the default value of %TEMP% and %TMP% to reside somewhere deep within the current user's home directory, and removed the previous default directory C:\Temp and C:\TMP. For some reason, Vim doesn't (as of 2013-03-07) use $TEMP or $TMP for the default value of the 'directory' option. Fixing this is easy, just put this in your .vimrc:

set directory=.,$TMP,$TEMP

See http://code.google.com/p/vim/issues/detail?id=28 for current status of this issue.

Comments[]

 TO DO 

  • This tip needs reworking. A reader could get the impression that the only cause for the specified errors is due to TMP.
  • Add a brief explanation of what the environment variables do.
  • Probably want reference to :help dos-temp-files. Any others?
  • The title is not helpful because a reader would only search for this title if they already knew the cause of their problem.