I just started using tmux along with slime, PyShell and IPython and I have ran into the following problem.
I am trying to run the following code:
names = ['a', 'b', 'c']
nc = { name : 0 for name in names}
count = 1
for name in names:
nc[name] += count
count += 1
print(nc)
and when I normally run the file in terminal using python3 file.py, it correctly returns {'a': 1, 'b': 2, 'c': 3}.
However, when running this with slime, it is saying that there is an unexpected indent and the error message is showing that the following is being inputted:
names = ['a', 'b', 'c']
nc = { name : 0 for name in names}
count = 1
for name in names:
nc[name] += count
count += 1
print
However, this is not what I am inputting. Here is a
to show this. Where is the problem coming from?
The error is caused by IPython inserting an indent automatically. To turn off automatic indent, use
%autoindentcommand in IPython. To keep the option off when you restart IPython, add the lineto your ipython_config.py which is located in a profile_profilename folder under the
~/.ipythondirectory on Linux. The default config would be located at~/.ipython/profile_default/ipython_config.py. If you don't already have a config file, runto create a default profile or name it something else by replacing
defaultin above command with the desired profile name.