I have recently lost all of my data from a mistake with GitHub. I found a way to retrieve the information one by one. See here: Why did the GitHub windows client delete all of my work? . I now have decided to make a Python program to automatically retrieve the data. I have done the process manually and it works fine. For some reason when I call the command: git cat-file -t code
, it returns: fatal: Not a valid object name code
. You replace code with the hexadecimal number. For example, 0921d007bc8ca0000a587181263cf4f8d4d38e31
. I do this in a for loop. I use
def runProcess(exe):
p = subprocess.Popen(exe, cwd="C:/Users/Ajay/github folder/", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
while True:
retcode = p.poll() #returns None while subprocess is running
line = p.stdout.readline()
yield line
if(retcode is not None):
done = True
break
to run the command prompt commands. Can someone please explain why this error only happens in Python and if I have done something incorrectly or if I should fix something.
Thanks!
For some reason I used shell=False
. If you change that to shell=True
it works fine. When it is enabled it emulates the shell and works fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.