# Cannot upload by python api

**URL:** <https://discuss.huggingface.co/t/cannot-upload-by-python-api/51551>\
**Category:** Spaces\
**Created:** [August 21, 2023, 4:56pm UTC](https://discuss.huggingface.co/t/cannot-upload-by-python-api/51551 "2023-08-21T16:56:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fyaer](https://avatars.discourse-cdn.com/v4/letter/f/65b543/32.png) [@Fyaer](https://discuss.huggingface.co/u/Fyaer)\
**Post date:** [August 21, 2023, 4:56pm UTC](https://discuss.huggingface.co/t/cannot-upload-by-python-api/51551/1 "2023-08-21T16:56:41Z")

</div>

Can’t upload file by huggingface python api in Space Project.  
for test,I tried uploading a \<1Mb file by **huggingface-hub==0.16.4 and python:3.10 docker image**  
but it didn’t show uploading progress bar like normal ,then code end.  
Log told the login successful and no error. but application finished like there was no uploading code.  
Need help .  
Python Code:

> import huggingface\_hub  
> huggingface\_hub.login(MY-TOKEN)  
> huggingface\_hub.HfApi().upload\_file(path\_or\_fileobj=‘requirements.txt’, path\_in\_repo=‘requirements-de.txt’, repo\_id='Fyaer/repo,repo\_type=“dataset”)  
> print(“Uploaded !!!”)
