Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
394 views
in Technique[技术] by (71.8m points)

import - Make running python shell dump PYC or source code of imported module which was deleted accidentally?

So I was making a git repo for a python project I've been working on for about a month and encountered a bug in GitHub desktop that caused the entire repo to disappear completely. When this happened, I was running a python shell in the PyCharm terminal in that directory, running a function imported from a module, and that function is still running right now. Examining the directory in another terminal shows no sign on any PYC files, and I'm also so far unable to use pycharms local history tool.

Before I ran this function, I imported the module via:

from solve import *

I only really care about one file, solve.py, the module I imported.

Once I ctrl-c this function or it terminates, is there any possible way to get the contents of the source code or the PYC by entering commands to the python shell?

Any help would be greatly appreciated. This was a personal project and it would honestly be against my better judgement to spend time trying to redo completely it at this point. If there's another exchange where this question would be better suited please let me know.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...