Skip to content

[BUG] dash doesn't get imported when a file named "org.py", "dash.py", or "test.py" with specific content is present in the current directory // "AttributeError: module 'dash' has no attribute 'Dash'" #1143

Closed
mstoelzle/solving-occlusion
#28
@cannatag

Description

@cannatag

Describe your context

dash (1.9.1)
dash-core-components (1.8.1)
dash-html-components (1.0.2)
dash-renderer (1.2.4)
dash-table (4.6.1)

Describe the bug

If a file named org.py is present in the current directory with the following content:

import dash_core_components as dcc

then dash doesn't import and I get the following message:

>>> import dash
Dash was not successfully imported. Make sure you don't have a file named
'dash.py' in your current directory.

Expected behavior
dash should import without any error.

Additional info

  • The org.py is never imported
  • If I rename the file to a different name dash get imported without any problem.
  • The problem is shown also with ``import dash_html_components as html```
  • The problem is shown either on Windows and in Linux
  • Tested with python3.4, python3.6, python3.8

Steps to replicate the problem on Linux

$ mkdir mytest
$ cd mytest
$ echo "import dash_core_components as dcc" > org.py
$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ pip install dash
(venv) $ python
Python 3.4.6 (default, Mar 01 2017, 16:52:22) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dash
Dash was not successfully imported. Make sure you don't have a file named
'dash.py' in your current directory.
(venv) $

if I rename the file the import works:

(venv) $ mv org.py othername.py
(venv) $ python
Python 3.4.6 (default, Mar 01 2017, 16:52:22) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dash
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions