#πŸ”’ Error CodeSnack IDE

130 messages Β· Page 1 of 1 (latest)

rapid acorn
whole gorgeBOT
#

@rapid acorn

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

last rune
#

Use a venv. "externally managed environment" means system python that doesn't like stuff to be directly pip installed there, as it may conflict with stuff installed via system packages.

Virtual environment will fix that

frail hill
#

just curious, whose server is that?

#

i should look into codesnack ig

rapid acorn
rapid acorn
frail hill
#

Looks like it is a docker container

rapid acorn
last rune
whole gorgeBOT
#
Virtual environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
frail hill
#

dammit

rapid acorn
last rune
frail hill
#

/FKmzpuqUnZ
(bot keeps removing my link 😭)

rapid acorn
#

i can delete this or not ?

last rune
rapid acorn
#

@last rune when i want to activate it doesn’t work

vapid ocean
rapid acorn
#

can u copy what i have to write

vapid ocean
#

aside from the fact that you havent put in a token

#

but what is your error

#

and what are the warnings when you use decorators

rapid acorn
#

idk how

vapid ocean
rapid acorn
#

ok i try

vapid ocean
#

forward slashes

rapid acorn
vapid ocean
#

run ls

rapid acorn
vapid ocean
#

yeah you dont have a venv

rapid acorn
#

wtf

vapid ocean
#

if you want one, it's py3 -m venv .venv

rapid acorn
vapid ocean
#

that should be right

vapid ocean
rapid acorn
#

i already did python3 -m venv .venv

rapid acorn
vapid ocean
vapid ocean
#

yeah honestly i'd just use global pip and not bother with venv's if they're failing

rapid acorn
#

np

#

i try again wait

rapid acorn
#

its same as .venv ?

vapid ocean
#

yeah same thing

rapid acorn
#

ok perfect

vapid ocean
#

wait does ls not list folders prefixed with .

rapid acorn
#

maybe idk

#

i can try to add a . before venv?

vapid ocean
#

wait

#

ls -a will list all files including hidden files (files with names beginning with a dot)

#

run that and i'm guessing .venv will be there

rapid acorn
#

wait

vapid ocean
#

lmk what you see

rapid acorn
#

yes i see it look

vapid ocean
#

ok remove it then

#

rmdir .venv

rapid acorn
#

i let the venv?

vapid ocean
#

?

rapid acorn
#

i remove only .venv or venv

vapid ocean
#

wait can you activate .venv

#

cuz i'd keep .venv

#

try .venv/Scripts/activate.sh

rapid acorn
#

i can retry

vapid ocean
rapid acorn
#

ok

#

dont work

vapid ocean
#

show error

rapid acorn
#

i can try with the other

rapid acorn
vapid ocean
#

hold on lemme try this

#

does it work with normal venv

rapid acorn
#

same error…

vapid ocean
#

wait there IS no sh

rapid acorn
#

?

#

wdym

vapid ocean
#
➜ ls
ο…› activate           activate.bat      ο…› activate.fish     󰞷 Activate.ps1       deactivate.bat
󰣆 pip.exe           󰣆 pip3.13.exe       󰣆 pip3.exe          󰣆 python.exe        󰣆 pythonw.exe
#

my ls got me this

#

there's activate, activate.bat, activate.fish and Activate.ps1

#

OH

#

its completely different on linux

rapid acorn
#

lol np

#

wait

vapid ocean
#

@rapid acorn it's .venv/bin/activate

rapid acorn
#

i maybe found

vapid ocean
#

i assumed they were the same mb

#

you can rmdir venv then

rapid acorn
#

i do with .venv or venv

rapid acorn
vapid ocean
rapid acorn
#

i tried with both

vapid ocean
#

wtf

#

oh run . .venv/bin/activate

#

(or source instead of .)

rapid acorn
#

ok wait

#

it work ?

last rune
vapid ocean
#

yep works perfectly

last rune
rapid acorn
vapid ocean
vapid ocean
last rune
rapid acorn
#

why i have this

vapid ocean
rapid acorn
#

yes

vapid ocean
#

nicky would i be right in saying his editor is pointing to the wrong python instance

last rune
#

Probably

rapid acorn
#

it worksss

#

but i have the warning next to @

#

idk why

last rune
# rapid acorn but i have the warning next to @

Browse settings. Somewhere in project settings there should be something about interpreter - make it point to python inside the venv

That way IDE will know which python's libs to check for hints like that

rapid acorn
#

what i need to change for run the code

last rune
#

That's not related to what I said

rapid acorn
#

yh i know

whole gorgeBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.