# Python : from hubspot.files import FolderInput, ApiException --\> error

**URL:** <https://community.hubspot.com/t/python-from-hubspot-files-import-folderinput-apiexception-error/93646>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [November 9, 2023, 8:16am UTC](https://community.hubspot.com/t/python-from-hubspot-files-import-folderinput-apiexception-error/93646 "2023-11-09T08:16:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aregout](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@aregout](https://community.hubspot.com/u/aregout)\
**Post date:** [November 9, 2023, 8:16am UTC](https://community.hubspot.com/t/python-from-hubspot-files-import-folderinput-apiexception-error/93646/1 "2023-11-09T08:16:56Z")

</div>

Hello,

I’m trying to use the official files API to upload files to HubSpot. I used the example snippet provided in the official documentation but I encounter an error when trying to import the librairy.

I didn’t encounter any error when importing

from hubspot.crm.contacts import BatchInputSimplePublicObjectInputForCreate, ApiException. I tried to upgrade with pip install hubspot-api-client but all dependencies seem to be satisfied already.

```lia-code-sample
import hubspot
from pprint import pprint
from hubspot.files import FolderInput, ApiException

client = hubspot.Client.create(
 access_token="xxxx")

folder_input = FolderInput(name="API test")

try:
 api_response = client.files.folders_api.create(folder_input=folder_input)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling folders_api->create: %s\n" % e)

```

```lia-code-sample
Exception has occurred: ImportError
cannot import name 'FolderInput' from 'hubspot.files' (C:\Python311\Lib\site-packages\hubspot\files\ __init__.py)
 File "G:\.shortcut-targets-by-id\1lxRq1qu-1mutw8lIx7LnWZlb-GNmcMnX\Duett\Hubspot\Data\ETL\python\example_upload_file_1.py", line 3, in <module>
 from hubspot.files import FolderInput, ApiException
ImportError: cannot import name 'FolderInput' from 'hubspot.files' (C:\Python311\Lib\site-packages\hubspot\files\ __init__.py)

```

Can you please help me with this?  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![Juanzabala](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/juanzabala/32/2490_2.png) [@Juanzabala](https://community.hubspot.com/u/Juanzabala)\
**Post date:** [February 13, 2024, 5:34pm UTC](https://community.hubspot.com/t/python-from-hubspot-files-import-folderinput-apiexception-error/93646/2 "2024-02-13T17:34:45Z")

</div>

The import statement in the documentation is:

from **hubspot.files** import ImportFromUrlInput, ApiException

 ![Juanzabala_0-1707845229908.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/b/5b1e3549165febbd35024edb2196fb53e197d66e.jpeg)

However the file structure is **discovery/files/files,** so to make it work you have to modify it to

from **hubspot.files.files** import ImportFromUrlInput, ApiException

You have to also modify

api\_response = **client.files.files.files\_api**.import\_from\_url

 ![Juanzabala_2-1707845556991.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/e/9e069e8bacbec8ba3a556076e1882f5715825d0d.png)

We have already reported this issue, but with this modification it works perfectly.
