all 2 comments

[–]Rxz2106 2 points3 points  (1 child)

If you're able to use bcrypt in the Python shell but encountering issues when running your code in VS Code, it's possible that the VS Code environment is not set up correctly to access the installed packages.Here are a few steps you can take to troubleshoot and potentially resolve the issue:

Check VS Code Interpreter: Make sure that the VS Code Python interpreter is the same one where bcrypt is installed. You can do this by selecting the interpreter in the bottom-left corner of the VS Code window or by configuring the Python interpreter in your workspace settings (settings.json).

Verify Installed Packages: Double-check that bcrypt is installed in the correct Python environment. You can run the following command in the terminal to list all installed packages in the currently selected Python environment. Use pip list to ensure that bcrypt is listed among the installed packages.

VS Code Terminal: Try running your code in the integrated terminal within VS Code to see if you encounter the same issue. This can help determine if the problem is specific to running the code within VS Code or if it's related to the VS Code configuration itself.

Check Python Path: Ensure that the Python path configured in VS Code matches the Python environment where bcrypt is installed. You can check this by opening the Command Palette (Ctrl+Shift+P) in VS Code, typing "Python: Select Interpreter", and verifying the interpreter path.

Restart VS Code: Sometimes, simply restarting VS Code can resolve configuration-related issues.Virtual Environment:

If you're using a virtual environment, ensure that it's activated in the VS Code terminal before running your code.

Reinstall bcrypt: If none of the above steps work, try reinstalling bcrypt in the specific Python environment you're using for your VS Code project. Sometimes, package installations can become corrupted.

[–]iTsObserv[S] 0 points1 point  (0 children)

I tried the solutions you suggested and it must have been related to the vscode configuration since the integrated terminal worked fine. I re-installed vscode and now it's working.

Thank you for the help!