Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPatrick Brusven
14,520 PointsCan someone explain "cd rpg" at 2:10 in this video, also expand on interactive mode vs importing in the console?
I realize this establishes where the Inventory and Item are being imported from, but not sure if this was covered more in-depth in a previous video? Is there a reason Kenneth is importing directly in the console opposed to importing into another file like he did for play.py? Also, is there a difference between say importing in the console vs interactive mode like 'python -I play.py' in the console?
1 Answer
Carter Pringle
3,416 PointsBy default you're in the workspaces /workspace folder, cd let's you set a new default. He sets it to rpg (so it's workspace/rpg). Otherwise to run scripts (interactive or not) you'd have to type :python rpg/xyzname.py
Rather than
python xyzname.py
The -i is to run it as interactive, I believe Craig Dennis explains that it in earlier course
Basically cd is to save the extra keystrokes, but theoretically if you were working on a project with a deep file structure you'd want to have your console running in the directory where you're testing out these classes/scripts/files
Not sure if I explained that well or not but I tried lol