Reputation: 105
I'm studying from 'Coding the matrix' by Philip Klein. In chapter two, there's an example for plotting complex numbers
from plotting import plot
S = {2+2j, 3+2j, 1.75+1j, 2+1j, 2.25+1j, 2.5+1j, 2.75+1j, 3+1j, 3.25+1j}
plot(S, 4)
plotting module: http://resources.codingthematrix.com
When I run the code directly through python in the terminal, it works fine, but when I run it as seperate file "$ python example.py", I get this error:
gvfs-open: file:///tmp/tmpOYFVs8.html: error opening location: Error
when getting information for file '/tmp/tmpOYFVs8.html': No such file
or directory
Not sure how to resolve this. Tried to play with module code a bit, but got nowhere.
Upvotes: 2
Views: 371
Reputation: 591
open plotting.py then patch this
hpath = os.getcwd() + "/something.html"
Instead or a line after this
hpath = create_temp('.html')
Upvotes: 0
Reputation: 689
I checked the code of plotting.py and found out that there is atexit event registered at the end of the code which basically deletes the file when your programs exits.So when you invoke it as script python intrepreter exits which will intern calls atexit register to delete the file.
def remove_at_exit(path):
atexit.register(os.remove, path)
you can directly comment out the call to remove_at_exit method in plotting.py at line no 92
Upvotes: 1