smartcontractkit / full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
MIT License
10.81k stars 2.91k forks source link

.env trouble #1554

Closed PratyushNag closed 2 years ago

PratyushNag commented 2 years ago

Discussed in https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions/1397

Originally posted by **Reus1196** April 12, 2022 ![image](https://user-images.githubusercontent.com/98214304/163018342-c7d588ce-0d55-4f6c-b546-2cedf37cba55.png) I was working OK with my .env and then it just started showing errors that I cannot solve. Any help?
cromewar commented 2 years ago

Could you try removing the keyword export? and see if that helps.

PratyushNag commented 2 years ago

As an update on this issue, the red lines still shows, and VScode still thinks its an error, though if I just go ahead and run my program as is, it now has no troubles executing whatsoever. (Previously it was it not running and gave a certain error saying it cannot parse the line 1 and line 2 of the .env file. After Reloading VScode, and properly checking my imports, it continues to show red lines but the program works and gives the outputs I need)

Though I have tried removing the word export and it still gives the same error as "Cannot find "

cromewar commented 2 years ago

Hum something may be messing up with your vscode, may bien an extension or a configuration... could you share your setting.json @PratyushNag ?

PratyushNag commented 2 years ago

image

PratyushNag commented 2 years ago

After moving along in the course, I'm now at the brownie fund me lesson, here we again have to create a new .env file and repeat the steps we did in the previous lesson to connect to rinkeby. Though in the previous project, with what miracle the code worked I have no idea, but I have run into this error again and I'm getting the same error as last time, "unable to expand env variable" image_2022-06-23_220300836

PratyushNag commented 2 years ago

I finally got it to work, turns out this errors happens if the brownie-config file is not saved, if you make changes to the .env file make sure you save the .env file as well as the config file. Even if you haven't changed anything in the config file, saving it again solves this error for me. Hope this helps others struggling with the same error

dankorea commented 2 years ago

Hum something may be messing up with your vscode, may bien an extension or a configuration... could you share your setting.json @PratyushNag ?

Oh...this problem kept messing me for 2 days until i rename the .env to x.env then changed it back to .env, when i saved all red lines disappeared. done! so amazing....!