HSHATA
HSHATA

Reputation: 113

How to pass -Xfrozen_modules=off to python to disable frozen modules?

Running a python script on VS outputs this error. How to pass -Xfrozen_modules=off to python to disable frozen modules?

snippet of the shell

I was trying to update the python version from 3.6 to 3.11 and then started seeing this message.

Upvotes: 11

Views: 14401

Answers (2)

GoldDragonTSU
GoldDragonTSU

Reputation: 489

Visual Studio 2019

In the example screenshots, the project I was using (i.e. "YourProjectName" in the following instructions) was "PythonExperiment".

  1. Project menu > YourProjectName Properties

        Location of Project menu and Project Properties menu option

  • Alternative Step 1: Click the dropdown arrow of the "Start" button in the header and select YourProjectName Debug Properties from the dropdown menu.

        enter image description here

  1. A new tab should open having the name of YourProjectName. Inside the tab, ensure Debug is selected on the left. On the right, look for the Run section. Enter -Xfrozen_modules=off into the Interpreter Arguments textbox.

Location of Interpreter Arguments within Project Properties - Debug settings

  1. Save your changes. You can close the tab.

Upvotes: 0

torakaou
torakaou

Reputation: 333

If you are using VS Code you can add "pythonArgs": ["-Xfrozen_modules=off"] to your debug configuration in launch.json, like this:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python (Xfrozen=off)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "pythonArgs": ["-Xfrozen_modules=off"]
        }
    ]
}

There is some additional context in the GitHub Issue fabioz/PyDev.Debugger/issues/213.

Upvotes: 14

Related Questions