Skip to content

notebook.py causes ModuleNotFoundError when using PyCharm #1294

@SuomiKP31

Description

@SuomiKP31

Running logic.ipynb in JetBrains PyCharm will execute this script (Located in "<venv/Scripts/jupyter-notebook-script.py>") to start the Jupyter server. The python version is 3.10, both venv & conda were tested.

import re
import sys

from notebook.app import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

A ModuleNotFoundError will be raised here since there's a file named "notebook.py" within the root folder of AIMA.
The script will report that "notebook" is not a module thus it cannot do "from notebook.app import main".
Renaming this file to "notebook_AIMA" fixed the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions