There is two things to try. One, is this (which is not a very reliable method due to file size issues);
file = open('gnuplot.gp','r')
plot = file.read()
file.close()
file = open('final.gp','w')
file.write(plot)
file.close()
Or, the other is, as others suggested, shutil
.
import shutil
shutil.copyfile('gnuplot.gp','final.gp')
Of course, this is all assuming you have permissions. If you get [Access Denied]
, you'll either need to delete final.gp
, and then copy, and/or make sure the destination directory or gnuplot.gp
is not read only. If you get an empty file after trying the first method, that is because python can't handle many file types, so shutil
would be the way to go.