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!
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

Robert Kwiat
5,349 PointsUsing the Console in Python
I am trying to use the Console but every time I type in my file "python string multiply.py" I either get the error "-su: a: command not found" or "python: can't open file 'stringmultiply.py': [Errno 2] No such file or directory" I am using workspaces. Please tell me why this is happening. Thanks
6 Answers

Kenneth Love
Treehouse Guest TeacherI haven't seen that happen in my Workspaces. Can you post the code to string_multiply.py
?

Robert Kwiat
5,349 PointsYes, thanks!
This part is in stringmultiply.py
input_string = input("What string do you want to use? ")
input_int = input("How many times should I repeat it? ")
print(input_string * int(input_int))
This part is in the console
treehouse:~/workspace$ python stringmultiply.py
python: can't open file 'stringmultiply.py' : [Errno 2] No such file or directory
treehouse: ~/workspace$

Kenneth Love
Treehouse Guest TeacherThis might sound silly but gotta cover all the bases. You did save stringmultiply.py
, right?

Robert Kwiat
5,349 PointsYes, I saved it.

Chris Shaw
26,663 PointsHi Robert,
The original command you posted shows a space between string
and multiply
which won't work, you will either need to add a hyphen or underline between these words.

Seth Weaver
1,358 PointsI had a similar problem in Workspaces with the same error:
python: can't open file 'spam.py': [Errno 2] No such file or directory
I hadn't encountered this before, and I had made only one change before this happened. I created a couple folders and moved the files to them.
Removing a file from the folder eliminated the error.
I don't know how to access the file while it is in the folder.

matt g
679 Pointsthis was happening to me too! create new folder
copy your code
in the new folder> create new file>paste code>save
drag the NEW FILE into the existing folder (not the NEW one)
and it works!