Skip to content

E484: Can't open file c:\Users\username~\AppData\Local\Temp\VIo7EE2.tmp #86

Open

Description

@0xnandhi

On Windows 10, i am facing this issue. Unable to open the temp dir for writing.

My _vimrc file:

`let $TMPDIR = "C:/Users/Balasubramanian/.vim/temp"

" initial vundle configuration.
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"plugin installation
"vundle plugin

Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'DoxygenToolkit.vim'
"Plugin 'rip-rip/clang_complete'
Plugin 'valloric/youcompleteme'
Plugin 'brookhong/cscope.vim'
Plugin 'airblade/vim-rooter'
Plugin 'klen/python-mode'
Plugin 'nlknguyen/papercolor-theme'
Plugin 'google/vim-maktaba'
Plugin 'google/vim-codefmt'
Plugin 'google/vim-glaive'
Plugin 'flazz/vim-colorschemes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'bling/vim-airline'
Plugin 'w0rp/ale'
Plugin 'cython/cython'

call vundle#end()
filetype plugin indent on
" the glaive#Install() should go after the "call vundle#end()"
call glaive#Install()
" Optional: Enable codefmt's default mappings on the = prefix.
Glaive codefmt plugin[mappings]
Glaive codefmt google_java_executable="java -jar C:/Users/Balasubramanian/.vim/bundle/vim-glaive/google-java-format-VERSION-all-deps.jar"
`

Can the community please help me ? every time i have to format the code, i am using a Visual Code to format it and i have to switch back to Vim for coding.

I have also disabled my "RealTime Scanner" , even then, get the same issue.

Thanks

Activity

  1. dbarnett commented on Dec 4, 2017

    @dbarnett
    Contributor

    You're saying this happens only when you have codefmt enabled? Hard for me to see how that would be related. If so, is there a more complete error you could paste?

  2. jasonwangm commented on Jun 3, 2018

    @jasonwangm

    I met with the same problem and have found no method to solve this issue.

  3. dbarnett commented on Jun 3, 2018

    @dbarnett
    Contributor

    So this triggers in particular when you run :FormatCode? Are there any other error details you can provide? Does it trigger the same sort of error if you run

    :call maktaba#syscall#Create(['cat']).WithStdin('').Call()

    or

    :call maktaba#buffer#Overwrite(1, line('$'), [])

    ?

  4. rachaeldawn commented on Jun 7, 2018

    @rachaeldawn

    @dbarnett
    I encounter the same issue using GVim on Windows 10. Of your code snippets, the second one does work perfectly fine. I think the tmp file is either not being created correctly, or vim does not have permission to create the tmp file.

  5. dbarnett commented on Jun 7, 2018

    @dbarnett
    Contributor

    So you see the same sort of error with the first one?

    How about

    :echo has('job')

    and

    :call system(printf('cat > %s 2> %s', tempname(), tempname()), [])

    ?

  6. rachaeldawn commented on Jun 8, 2018

    @rachaeldawn

    @dbarnett
    First one responds with 1
    Second one flashes a window really quick and doesn't appear to do anything else.

    If you need access to my machine, drop me a message and I'll get a TeamViewer session going. But for me it's super reproducible.

    1. Install gvim
    2. Setup plugins
    3. :FormatCode in a TypeScript file
    4. Get error
  7. dbarnett commented on Jun 8, 2018

    @dbarnett
    Contributor

    Okay, so to summarize observations so far and give you some context, the gist of this bug seems to be that:

    • there's some issue on vim on Windows 10 that makes maktaba syscalls not work
    • may or may not be specific to the way maktaba is invoking the syscalls
    • seems to be specific to using vim job support

    Sounds like you see an error with

     :call maktaba#syscall#Create(['cat']).WithStdin('').Call()

    but not with

    :call system(printf('cat > %s 2> %s', tempname(), tempname()), [])

    (can you confirm the first one does give you a E484 error?)

    I believe from the details you've given that you can temporarily work around it by disabling syscall job support when you're using Windows 10 by adding this to your .vimrc:

    call maktaba#syscall#SetVimjobDisabledForTesting(1)

    And then the remaining bit is to figure out whether it's a vim issue for Windows 10 or a maktaba issue.

  8. rachaeldawn commented on Jun 8, 2018

    @rachaeldawn

    Result of first call

    :call maktaba#syscall#Create(['cat']).WithStdin('').Call()
    Error detected while processing function maktaba#syscall#Call[3]..<SNR>112_DoSyscallCommon[16]..maktaba#function#Apply[1]..maktaba#function#Call[0]..maktaba#function#Call[13]..maktaba#syscall#DoCall:
    line 5
    E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoFBAB.tmp
    

    Second one does the flash, and no response

    Third code snippet, I put in and get the same result after running :FormatCode
    Error formatting file: Vim(let):E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoCD01.tmp

  9. kkkk9 commented on Jun 13, 2018

    @kkkk9

    I think the problem is in maktaba's usable_shell.
    I also met this problem,
    my solution is:

    1. add two lines in your _vimrc file.
    set shell=cmd
    set shellcmdflag =/c
    
    1. Then goto the ~/bundle/vim-maktaba/autoload/maktaba/syscall.vim
      change th code:
    if !exists('s:usable_shell')
      let s:usable_shell = '\v^/bin/sh$'
    endif
    

    to

    if !exists('s:usable_shell')
      "let s:usable_shell = '\v^/bin/sh$'
      let s:usable_shell = '\v^cmd$'
    endif
    

    Alghouth the solution is ugly, but worked for me..(Win7, Vim8)

  10. dbarnett commented on Jun 24, 2018

    @dbarnett
    Contributor

    Ah, it makes sense that /bin/sh would be problematic on Windows. I filed google/vim-maktaba#215 with my understanding of the issue and a suggested workaround based on @kkkk9's solution (can you comment there if the other 'shell' and 'shellcmdflag' overrides are actually necessary? IIUC those are vim's defaults).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions