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 trial

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
231,269 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
231,269 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
231,269 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
231,269 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
231,269 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.