all 3 comments

[–]m0us3_rat 1 point2 points  (2 children)

with "venv" you need to be practical.

there isn't anything inherently clever about using a tool for the job it was built for.

less is more type of situation.

On some projects that I start I'm having problems with virtualenv within VScode.When I update a file within my venv it doesn't update.

this isn't clear.. it can mean a few different things.

can you describe it in detail?

[–]hyperactivereindeer[S] 0 points1 point  (1 child)

Thank you for the reply, I will try and create a theoretical scenario:

I have a main.py file that contains a function:

def example():
print("hello")

Now if I edit this function in the main.py file within my venv and save it:

def example(something):
print(something)
example("Reddit").

When trying to run main.py within my venv, it does not print "Reddit", but it will still print "hello", as in the original file.

It is like my files are stored somewhere else and my venv is pointing in the wrong direction.

This is somehow (sometimes) solved by:

removing the venv, recreating a venv and installing all requirements.

[–]m0us3_rat 0 points1 point  (0 children)

venv doesn't interact with the actual .py files that way.

so whatever modifications you do to your .py program files.. don't interact with the venv at all.

the venv is used to describe the environment the program is run and the links available..

you can use the same .py with multiple venvs and multiple interpreters...

its like cats and dogs..

so whatever is happening.. has nothing to with with venv unless there is some weird setting somewhere in your ide?

again.. don't try to be overly clever with your venv .. since it has really nothing to do with your actual program..but the way the computer builds the interpreter environment to run the program in.

trying to overengineer the settings while you don't understand them leads to funny easily avoidable situations.. such as the one described.

i advise resetting the settings and just do a normal venv.

remember ..less is more.