# AttributeError: module '\_\_main\_\_' has no attribute '\_\_file\_\_'

**URL:** <https://forum.ecmwf.int/t/attributeerror-module-main-has-no-attribute-file/1724>\
**Category:** Other - Software and tools\
**Tags:** c3s, toolbox\
**Created:** [20 January 2021 09:06 UTC](https://forum.ecmwf.int/t/attributeerror-module-main-has-no-attribute-file/1724 "2021-01-20T09:06:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xudong\_zheng](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/x/a87d85/32.png) [@xudong\_zheng](https://forum.ecmwf.int/u/xudong_zheng)\
**Post date:** [20 January 2021 09:06 UTC](https://forum.ecmwf.int/t/attributeerror-module-main-has-no-attribute-file/1724/1 "2021-01-20T09:06:50Z")

</div>

First, pip install cdsapi and could run the example .py properly.

Seconda, pip install cdstoolbox-remote, but get&nbsp;AttributeError: module '\_\_main\_\_' has no attribute '\_\_file\_\_'.

Then, I open the \_\_init\_\_.py in the cdstoolbox package.

The contents are:

import \_\_main\_\_  
 import cdsapi  
 import sys

c = cdsapi.Client()

with open(\_\_main\_\_.\_\_file\_\_) as f:  
 code = f.read()

print(c.download(c.workflow(code)))  
 sys.exit(0)

The AtrbuteError mentioned above is in the "with open(\_\_main\_\_.\_\_file\_\_) as f:"

Thank you

---

<div class="post-metadata">

**Author:** ![Nicolas\_Degorce](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/n/59ef9b/32.png) [@Nicolas\_Degorce](https://forum.ecmwf.int/u/Nicolas_Degorce)\
**Post date:** [26 November 2021 15:44 UTC](https://forum.ecmwf.int/t/attributeerror-module-main-has-no-attribute-file/1724/2 "2021-11-26T15:44:57Z")

</div>

Hi,  
 I have the same issue. Did somebody found a solution?  
 Thank you
