[Python] Exception when importing freeze in Python 3.13

Discussão em 'Python' iniciado por Stack, Dezembro 6, 2024.

  1. Stack

    Stack Membro Participativo

    I created a virtual env with;

    conda create --name base_313 python=3.13 -y
    conda activate base_313
    code .


    Then ran this code;

    from types import freeze

    class k:
    AGE = 42
    NAME = "Zoubida"

    freeze(k)

    if __name__ == "__main__":
    print(k.AGE) # 42

    try:
    k.AGE = 84
    except TypeError as e:
    print(e)


    I got the exception below;

    ```powershell


    Exception has occurred: ImportError cannot import name 'freeze' from 'types' (c:\Users\phili\anaconda3\envs\base_313\Lib\types.py) File "C:\Users\phili\OneDrive\Documents\Tmp\const\main.py", line 24, in from types import freeze ImportError: cannot import name 'freeze' from 'types' (c:\Users\phili\anaconda3\envs\base_313\Lib\types.py)


    ```powershell
    conda --version
    conda 24.5.0

    Continue reading...

Compartilhe esta Página