Skip to content

Jupyter Not Supported Standard Python Scripts Rule #7630

Closed as not planned
Closed as not planned
@neerajpatel2505

Description

@neerajpatel2505

In standard Python scripts (.py files):

If the first line starts with an unexpected indent (a space or tab), Python will raise an IndentationError.
Example:
print("Hello")
This gives:
IndentationError: unexpected indent
Python expects top-level code to start at column 0 unless it's inside a block (like a function or loop). So that space is a no-no outside of those.

But in Jupyter Notebook:

Jupyter is more forgiving — it allows leading spaces in the first line of a cell even if the code is at the top level. It doesn't strictly enforce indentation rules the way a .py file would when executed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions