Extracting zip in space work enviornment throws : runtime error Space not ready. Reason: Completed, exitCode: 0, message: None
runtime errorSpace not ready. Reason: Completed, exitCode: 0, message: NoneHey there, i tried below code to extract a zip file located in my space project directory where i wants to extract the files besides app.py. some how the code runs successfully but can’t find the extracted files and output says ‘# runtime error ## Space not ready. Reason: Completed, exitCode: 0, message: None’Code::import osimport shutilfrom os import pathfrom zipfile import ZipFilefrom shutil import make_archivedef main():filename = “master.zip”extract_dir = “master”archive_format = “zip”if path.exists(filename):
    print ("yes ur zip location exists.")
    src=path.realpath(filename)
    root_dir,tail = path.split(src)
    extract_dir=root_dir+'/'+extract_dir
    shutil.unpack_archive(filename, extract_dir, archive_format)
    print ("Archive file unpacked successfully.")
else:
    print ("Error: Archive file unpacked un-successfully.")ifname==“main”:main()Is there any push commit query required to make changes in project directory while writing files and folders into it. if it so than please guide on the same.
2022-10-04T14:14:55Z
Hello@nightfury,Could you provide a link to the failed space please ?Did the logs give you any information regarding the failure ?
2022-10-04T14:37:33Z
runtime errorSpace not ready. Reason: Completed, exitCode: 0, message: NoneNo container log shows no failure msg,…https://huggingface.co/spaces/nightfury/SD-InPainting
2022-10-04T14:54:56Z
Well from what I can see there is no failure.Your main inapp_t.pydoes not start the gradio app, so the process just ends, hence theCompletedin theReason
2022-10-04T15:32:02Z
yaa but where are the files extracted, i can’t find them in my space project. i needs those files and folders
2022-10-06T07:48:24Z
Not sure what you’re trying to achieve.Between two run of your space files that were generated/extracted are not kept. If you need the extracted files at runtime you need to extract them before launching your main app within the same run.
2022-10-06T10:40:46Z
hey as you know importing files and folders in huggingface spaces project is not possible and except for creating a file there is no option to create a new directory or something.what i want is to add additional py codes and use them in references and change wherever applicable. i can see many projects has codes in folders and i don’t know how they are importing them.So to import multiple .py files and folders i zipped them in my local directory and now using single file upload option has uploaded a zip file… now the issue is i wants them to extract them all in src. now thats where im stuck in. Extracting them is a big question on how to do it.I dont want them just at run time, i wants the extracted files and codes to use.so thts all in requirements and issues.
2022-10-06T10:42:04Z
tried this above code but it does extraction at runtime, doesn’t commit to access them in my project.
2022-10-06T13:42:11Z
Nothing you do in the space will have an impact on your space repository.If you want to add these files you should git clone your repositorygit clone https://huggingface.co/spaces/nightfury/SD-InPaintingThen you should add your folder in the project, commit the folder and files and then push.
2022-10-06T17:39:29Z
git clone to where ?huggingface repositoryorgithub repository
2022-10-07T08:01:30Z
You can clone your huggingface repository locally, in this instance huggingface acts as a version control similarly to github.So simplygit clone https://huggingface.co/spaces/nightfury/SD-InPaintinglocally on your system, add the files, commit and push.
2022-10-07T15:02:15Z
im still not getting it.im itself in the same project. why to clone my own project. will it execute automatically to extract zip files in it?& where to write this code ’git clone https://huggingface.co/spaces/nightfury/SD-InPainting’ ? in requirements file?
2022-10-07T15:03:57Z
Locally you mean via github desktop setup or cmd tool?
2022-10-10T07:54:42Z
Yes locally I meant using the git cmd
2022-10-12T15:39:48Z
yup that worked… but had to go through git cmd allover again… cloning, pull, push & commit