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 Python Basics (Retired) Putting the "Fun" Back in "Function" Introduction To Functions

Fred Sites
Fred Sites
11,151 Points

Workspaces wont indent?

Anyone else having this issue in the workspaces console? Trying to go through this exercise and workspaces refuses to indent, causing an error.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

In workspace, you can set the default indent amount in the lower right corner of the editor window. It should say something like:

Python Spaces 4

Adjust it by clicking on the number or "Spaces" to change to "Tab" (but don't because spaces are preferred!)

What does yours say?

Fred Sites
Fred Sites
11,151 Points

Mine says spaces 2, however this seems to only apply to the script, not the console.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

The console is like the regular shell, there is no auto indent in the shell when running python interactively. There is an improved interactive python called ipython, but it is not installed. You can install it using:

treehouse:~/workspace$ ipython                                                                   
-bash: ipython: command not found                                                                
treehouse:~/workspace$ pip install ipython                                                       
Downloading/unpacking ipython                                                                    
  Downloading ipython-3.1.0-py3-none-any.whl (3.4MB): 3.4MB downloaded                           
Installing collected packages: ipython                                                           
Successfully installed ipython                                                                   
Cleaning up...                                                                                   
treehouse:~/workspace$ ipython                                                                   
Python 3.4.1 (default, Apr 10 2015, 01:07:53)                                                    
Type "copyright", "credits" or "license" for more information.                                   

IPython 3.1.0 -- An enhanced Interactive Python.                                                 
?         -> Introduction and overview of IPython's features.                                    
%quickref -> Quick reference.                                                                    
help      -> Python's own help system.                                                           
object?   -> Details about 'object', use 'object??' for extra details.                           

In [1]: def fun():                                                                               
   ...:     print("hello")                                                                       
   ...:                                                                                          

In [2]: fun()                                                                                    
hello                                                                                            
Fred Sites
Fred Sites
11,151 Points

Gotcha, I thought there would be no indent in console but confused as he seemed to indent no problem in the video. I figured it'd be built in for ease of use/following along as there is no mention of it in the video. I guess he was just spacing. Thanks Chris!