Python Using Databases in Python Our Diary App Doing Data Entry

Frederick Chute
Frederick Chute
Python Web Development Techdegree Student 9,205 Points

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
171,327 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,060 Points

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

Steven Parker
Steven Parker
171,327 Points

Try it without the "\r".

Ross Coe
Ross Coe
5,060 Points

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

Steven Parker
Steven Parker
171,327 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,060 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
171,327 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,060 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,060 Points

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

Steven Parker
Steven Parker
171,327 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.