Problem with savefig from Plots package

I had the following code that worked well until today. I didn’t change anything, only Julia version.

using Plots
using Printf
function plotrand(t)
       plot(rand(10),rand(10))
       sav=@sprintf("%d",t)
       savefig(sav)
end
map(plotrand,1:5)

The function worked perfectly when I was using Julia 1.0.3 with Atom but doesn’t work anymore with Julia 1.1.1. I get the following error:

ERROR: SystemError: opening file "C:\\Users\\User\\AppData\\Local\\Temp\\jl_A660.tmp.png": No such file or directory

Can anyone tell me what’s happening? Why does the code fail now if I didn’t change anything?

Your code works for me fine on Jupyter with Julia 1.1.1.

Maybe it’s something with the folder you’re running in? The end of your path name (jl_A660.tmp.png) seems a bit odd. The code as written saves files 1.png-5.png for me, not “jl_A660.tmp.png”.

As I said , I didn’t change anything and simply run the same code but on Julia 1.1.1. The error message is one of the messages I get because it changes when I try to run the code again