.env file is supposed to be located where you launch dagster dev from, so in your case: D:/python/venv/myVenv/Script/
But I think the issue is how or where you are using EnvVar as I also ran into this unexpectedly.
I think this line from the docs can be easily overlooked as I certainly did:
"
Configurable Dagster objects - such as ops, assets, resources, I/O managers, and so on - can accept configuration from environment variables."
So I think what this means is that EnvVar() doesn't work outside of those configurable dagster objects. In other words as an example, the last line below in my example code, my print statement below only prints the key and not the value. I was expecting that it would print the value and not the key. When it is in the configured() function, it worked as expected, it got the key's value from the .env file. But after re-reading that line from the docs, I realize perhaps I can't use EnvVar outside of a configurable object. I could be wrong though or maybe we should be able to and it doesn't work on Windows. I'm hoping someone from dagster team can chime in and confirm. I'll have to check in my Ubuntu WSL if I'm getting the same result. To be honest, I would like to be able to use EnvVar in any context or anywhere in my Python script in the event I want to pass that value to a variable that I can then use with a non-configurable Dagster object.
defs = Definitions(
assets=[build_asset(data_set) for data_set in data_sets],
resources={
"faa_io_manager": duckdb_pandas_io_manager.configured(
{
"database": EnvVar("DUCKDB_FAA_DB"),
}
),
},
)
print(f'DUCKDB_FAA_DB: {EnvVar("DUCKDB_FAA_DB")}')