Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Using Databases in Python Our Diary App Doing Data Entry

To get ./diary to work on windows I used #!/usr/bin/env python

The only installation of Python I have on my machine currently is Python3. If I had python2 as well though then I would probably need to specify which version I wanted to run though right?

6 Answers

Steven Parker
Steven Parker
221,324 Points

The "shebang" (or "hashbang") is a Linux/Unix program loader directive. I would not expect it to be effective on a Windows system.

Ross Coe
Ross Coe
5,061 Points

this is not working in workspaces - /usr/bin/env: 'python3\r' No such file or directory

Steven Parker
Steven Parker
221,324 Points

Try it without the "\r".

Ross Coe
Ross Coe
5,061 Points

it was without the \r - that was part of the return error

Steven Parker
Steven Parker
221,324 Points

In that case, it sounds like your file is in Windows text format (CR/LF) and not Linux format (LF only).

Ross Coe
Ross Coe
5,061 Points

this was in workspaces - though I found workspaces to be very cachey (?) sometimes if you run the exact same code in a different session and it will pass

Steven Parker
Steven Parker
221,324 Points

The workspaces use Linux. A "\r" is a return (CR) character, which should not be part of a Linux text file.

Ross Coe
Ross Coe
5,061 Points

Steven - I just used the she-bang on a file I'm using now Python Testing - Writing and Running Doctests and it worked.. I let you know if I see the \r again

  • I was in workspaces though (no "fake news" ;) )
Ross Coe
Ross Coe
5,061 Points

Steven Parker - can you have a look at /decorators/dec.py in that workspace https://teamtreehouse.com/workspaces/39916452#

Steven Parker
Steven Parker
221,324 Points

You can't share a direct link to a workspace, it's temporary and only exists while you are using it. But you can make a snapshot and share the link to that.