#πŸ”’ Trouble getting module paths to work in python with VSCode.

6 messages Β· Page 1 of 1 (latest)

sour shuttle
#

I'm currently working through "Deep Learning and the Game of Go", and many of the files it has me create start with statements like this:

from dlgo.agent.base import Agent

However, when I attempt to run this in VSCode, it gives me the following error:

(manimations) ➜  Python git:(main) βœ— /Users/billshillito/Documents/Python/.venv/bin/python /Users/billshillito/Documents/Python/dlgo/agent/naive.py
Traceback (most recent call last):
  File "/Users/billshillito/Documents/Python/dlgo/agent/naive.py", line 2, in <module>
    from dlgo.agent.base import Agent
ModuleNotFoundError: No module named 'dlgo'

If I change this to just from base import Agent because my naive.py lives in the same folder as base.py. However, I have the hunch I shouldn't be changing the code as it's written in the book.

For reference, I'm using VSCode for Mac (Tahoe 26.1), with the Python extension, and I have a keyboard shortcut that just hits the "Run Python File" button at the top right. This has always worked with other more self-contained programs I write such as Project Euler, but now it's giving me this issue. What should I be doing instead?

radiant trellisBOT
#

@sour shuttle

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.

sour shuttle
#

This is how I have my folder set up that I'm trying to run things from.

#

And here's a GitHub repository for the files from the book.
https://github.com/maxpumperla/deep_learning_and_the_game_of_go

If you go to code/dlgo you'll see the things I'm working on. I'm only very early in the book so I haven't written all the code in this yet. (And I'm not importing it with pip install dlgo because that would defeat the purpose of trying to learn how it all works.)

GitHub

Code and other material for the book "Deep Learning and the Game of Go" - maxpumperla/deep_learning_and_the_game_of_go

radiant trellisBOT
#

@sour shuttle

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.