-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing extra characters when beautifying python #215
Comments
I am experiencing the same issue. Running autopep8 from the command line does not produce the extra characters. |
+1, is there any workaround until this fix is finished? |
I am unable to reproduce this issue. Are you using What version of Atom, Atom Beautify, and autopep8 do you have? |
Not using beautify on save. OS: Mac OSX 10.10.2 I just verified that the bug is still occurring with all of the above. |
I am not able to reproduce with: OS: Mac OSX 10.10.2 How are you executing beautify?
Does the extra characters appear immediately after beautifying? Only on save? etc. I need to try and diagnose at what stage of the lifecycle is this error occurring, which is significantly harder since I am not experiencing this issue. |
Sorry I didn't mean to mislead you about beautify on save. It actually does occur during a beautify on save, I just wasn't using that feature. In fact, I just verified that the issue occurs for all of the above methods of executing beautify. The characters appear immediately after execution, not after a save. I thought it might be a weird artifact of the fact that I am using sshfs, so the editor is running on Mac and the code lives in a VM, but I just tested with a local file on the Mac, and the error still occurs. |
Atom: 0.187.0 Regardless if beautify on save is on or not, or if I manually beautify, it takes the following script #!/usr/bin/env python
# coding=utf-8
import setup
def main():
pass
if __name__ == '__main__':
main() and replaces it with (B�[m#!/usr/bin/env python
# coding=utf-8
import setup
def main():
pass
if __name__ == '__main__':
main() I feel like it has something to do with the encoding, because the extra bits look suspiciously like the UTF BOM. |
Could you remove the |
No effect, I actually added the coding line to force It's not autopep8, and I was able to confirm this by changing python_autopep8_path: "echo; /usr/local/bin/autopep8" to include the |
I wonder if it has something to do with [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bashrc ] && source ~/.bashrc; could you run that in your Terminal? |
Do you mean we should run that in a terminal and then launch atom from the terminal? If so, that was unsuccessful as well. |
Run that command from Terminal and see if there is any output. Atom Beautify is simply reading files, and autopep8 is writing to them. Both are pretty basic operations, so I'm trying to find out where those special characters are coming from. You mentioned that it happens even before the |
I'm not at my computer at the moment, but I will test when I get back. I do know that my bash_profile is setup to echo some control characters that iterm interprets into some GUI actions, so that's probably it. The default OSX bash_profile has that as well for Terminal.app to display the working directory in the title bar.
|
Yeah, that's it. Something's printing the |
I'm not sure where the control characters are coming from, but both of the following actions eliminate the problem:
@demosdemon do you also start Atom from the terminal? |
I've found the culprit in my |
Huh... Same thing here. I'd like to keep that tput command in there, though. Do you have a good solution without just removing that from bash_profile? |
I've currently moved the tput the start of my set_prompt so its echoed every time bash wants to display the prompt (which does not happen in this case), overkill but it'll stop this from happening. Other than that, in #233 I suggest making the path sourcing optional. I can't think of any other way to get the end goal of getting the path from the user's profile without the side effects of the profile echoing control characters. My only thought is that since, in my case, I'm already providing Another thing to think about is that stdout may not be necessary, since the cmd is being called from /bin/sh, redirection works. So instead of telling CLI to get the stdout, redirect the output of autopep8 to the temporary outputFile created. |
When I save any python code this is added at the beginning of the file:
The text was updated successfully, but these errors were encountered: