Atom adding space to <PongGame >


#1

Atom adds a space after PongGame in the rule of my python/kivy code (file.kv) after I save the file. I’ve tried disabling the whitespace package and it still adds the space.

I’m using python 3.6 and atom 1.10.0

How do i disable this?


#2

I started Atom --safe and it solved the issue. Just don’t know what that means.

I’m assuming (we all know what that does) there is a package that is adding the space …


#3

apologies for not doing this first, but I found the issue. The python-autopep8 package is adding the space. When I disable, everything is good.

Does anyone know how to modify this package so it does not add the space. I looked at the code and did not understand much.


#4

Unrelated: Any particular reason for not running the current version of Atom?


#6

My bad. The Atom version is 1.22.1

I’m currently learning Python, numpy, pygame and kivy. 1.10.0 is for kivy.

I will say that Atom is a very nice editor and will stay my editor of choice. I like everything about it.


#7

Hello.

I have had a look at the python-autopep8 package,
but did not get a good result for you.
Please allow me to share some findings, with the hope of other building on it.


Both the python-autopep8 and whitespace packages aim to ensure that the text file ends with a newline character. The whitespace package offers a user configuration. Research educated me that there is a traditionally good reason to do so.

The python-autopep8 package is an in-between to Atom and autopep8 (associated with Python development according to PEP8 formatting standard). The autopep8 command can be invoked in a terminal where some addition attributes can be triggered. More info - execute the command in the terminal as: autopep8 --help

From the list of formatting warnings and errors is one named W292 which is the last character is a newline character (70% sure).

It is possible to command autopep8 from the command line as:
autopep8 --ignore=W292 --in-place myFile.py

This will process the fictional file myFile.py to adhere (more-or-less) to the PEP8 specification and will write back into the original file. The ignore portion should exclude the usage of the last newline character… but it does not seem to do so.

So this is where I am stuck. I already know how to alter the python-autopep8 package to include for us the ignore attribute, but it is useless if the autopep8 command does not follow our request.


Not much of help to you - sorry. Perhaps python-indent package or similar will suit you better.

Regards.
- Dan


#8

It might help if you showed screenshots of what’s going on, and also the list of community packages you have installed. You can turn on Show Invisibles (File -> Settings -> Editor) to see precisely what character is creating that space, which could be helpful. To see a list of your packages, open a command line and type apm ls. Copy the Community section and post it here.