Error in gzfile(file, “wb”): cannot open the connection or compressed file

前端 未结 19 1069
自闭症患者
自闭症患者 2021-02-05 06:49

I\'m trying to run two things: first, I\'m creating a PDF with 4x5, ending with dev.off(), and then trying to create a new graph. However, after starting the second plot, I get:

相关标签:
19条回答
  • 2021-02-05 07:22

    In my case, when it happened first, months ago, the solution here worked.

    But recently, it came back, constantly... What solved this time was to change the anti-virus. I have not just the Windows defender, but also a 2nd anti-virus, the same in both times. I ended up deinstalling it and installing another antivirus... After this, the problem did not happen again...

    0 讨论(0)
  • 2021-02-05 07:23

    This is a bit late but for anyone coming here for help, I got this error when I was trying to write a file from RStudio and my destination file path was very long. I realized this could be a problem because when I wrote the file to another location with a shorter name and tried to copy it into my original destination, Windows gave me an error saying "File path too long". You might need to save the original file into another location with a shorter absolute path.

    0 讨论(0)
  • 2021-02-05 07:23

    I just ran into this problem after changing my system locale. Check your locale using Sys.getlocale(). Change it to appropriate one using Sys.setLocale("LC_ALL","ENG") (replace "ENG" with appropriate one)

    I can't say with certainty which locale would be appropriate, but it seems to be coherent with default OS one.

    Hope this helps!

    0 讨论(0)
  • 2021-02-05 07:26

    Maybe you should look here. At the end it says

    Note: The most common reason for failure is lack of write permission in the current directory. For save.image and for saving at the end of a session this will shown by messages like

    Error in gzfile(file, "wb") : unable to open connection
    In addition: Warning message:
    In gzfile(file, "wb") :
      cannot open compressed file '.RDataTmp',
      probable reason 'Permission denied'
    

    So rapidly, if you try getwd(), look at where is your working directory set. If you're trying to save your document in a place where it's not in your current working directory, it will throw you this error.

    At the end of your error message, it says probable reason 'No such file or directory' Graphics error: Error in gzfile(file, "wb") : cannot open the connection My diagnosis would be simply that it's trying to save your item in the wrong place and RStudio is not able to find the right place.

    0 讨论(0)
  • 2021-02-05 07:30

    In my case it was Windows Defender which was preventing Rstudio to write any file on hard drive. Either you need to turn Controlled Folder Access off or add Rstudio in the exclusion list.

    0 讨论(0)
  • 2021-02-05 07:31

    This burned me so hopefully saves someone else some toil. The issue was that the classifiers loaded just fine on OS X but on the Linux deployment system they would fail with the error listed in the question. The issue was the the files on the disk had extension abc.RData but the code modelAbc <- readRDS(file="abc.Rdata"). The difference in the upper and lowercase D in the .RData vs .Rdata extension would fail on Linux. It was not very noticeable but check your extensions for case.

    0 讨论(0)
提交回复
热议问题