Python Tab Issue


#1

Hello,

When I run Python-Module in interactive console I get the expected an indented block error. I have made my tabs with 3 spaces though.

Here is the case:

fox.py

def what_does_the_fox_say():
   print("vixens cry")

Interactive Python Console

>>> import fox
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Me\git\pythonTests\fox.py", line 2
    print("vixens cry")
        ^
IndentationError: expected an indented block
>>>

When I write it with an simple editor, it works. But If I write the same in Atom, I get these error.

I tried out the package python-indent with hope fixing it. But no. The same issue.

What can I do?


#2

Ok, now it works. Atom is realy sensible with python. With some files it works, but with some older one not. Well, hard to work with - but now it works.


#3

Atom has no ability to understand Python code. You have to be using a package to run it, and you need to tell us what the package is (the exact name; I looked and there’s nothing called “Interactive Python Console”). Without knowing what tools you are using, nobody can help you. If we do know, then we can usually explain how to find out what the issue is.


#4

Hey, thank youfor the reply.

“Interactive Python Console” is not a package for atom. It is called, if you use/run python in your terminal emulator. You can recognize is, when you see

>>> some command here or lines of code
somthing happens
>>> again your ode here, and so on
>>>

I know. Thats why I installed python-indent intend.

Like i described above.

Its realy weird. sometimes it works sometimes not. Rather then I use spaces instead of Tabs by the package python-indent.

So Python for exampl needs 3-times-spaces. If I do this manually, some script dont wokr like described above - expected an indend block

I love atom IDE, but this is realy realy hard to develope


#5

Hello.

Please can you activate the invisibles:
atom_2018-10-26_08-05-33

As you work, notice what the line endings, tabs and spaces do for the files of yours that works / does not work.

It would be most helpful if you have a look at the configuration file also:
atom_2018-10-26_08-06-17

I think you would want to use soft tabs with 3 spaces. This can be done either as a global setting or a setting localized for the grammar (Python / Java / C++). If the code file is not identified as Python, it may be using the global setting which creates problems for you.

What are your thoughts?


#6

thanks,

this is nice as fallback, if the indent-packages does not work some times. Looks great so far. Feels much better right now. Has no indent error.

Thank you :slight_smile: