Skip to content
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

Formatting gets error: AttributeError: 'NoneType' object has no attribute 'read' #57

Open
qwanzaden opened this issue Apr 14, 2023 · 1 comment

Comments

@qwanzaden
Copy link

qwanzaden commented Apr 14, 2023

On a fresh pip install of yapf, and a fresh sublime install of PyYapf, pressing ctrl+alt+f on a file with this one line of content:

import numpy

with nothing selected generates this error in the sublime text console:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 1494, in run_
    return self.run(edit)
  File "C:\Users\Chris Pratt\AppData\Roaming\Sublime Text 3\Installed Packages\PyYapf Python Formatter.sublime-package\PyYapf.py", line 455, in run
  File "C:\Users\Chris Pratt\AppData\Roaming\Sublime Text 3\Installed Packages\PyYapf Python Formatter.sublime-package\PyYapf.py", line 168, in __enter__
  File "./python3.3/shlex.py", line 276, in split
  File "./python3.3/shlex.py", line 266, in __next__
  File "./python3.3/shlex.py", line 93, in get_token
  File "./python3.3/shlex.py", line 121, in read_token
AttributeError: 'NoneType' object has no attribute 'read'

Following the instructions on this bug ticket to change pyyapf.py inside the directory C:\Users\Chris Pratt\AppData\Roaming\Sublime Text 3\Installed Packages by unzipping then re-zipping the file PyYapf Python Formatter.sublime-package, then restarting sublime text, generates this error instead.

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 1494, in run_
    return self.run(edit)
  File "C:\Users\Chris Pratt\AppData\Roaming\Sublime Text 3\Installed Packages\PyYapf Python Formatter.sublime-package\PyYapf.py", line 468, in run
  File "C:\Users\Chris Pratt\AppData\Roaming\Sublime Text 3\Installed Packages\PyYapf Python Formatter.sublime-package\PyYapf.py", line 271, in format
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1063, in _execute_child
  File "./python3.3/subprocess.py", line 625, in list2cmdline
TypeError: 'NoneType' object is not iterable

I am on windows 10, sublime text 3 (build 4143), and python 3.7.8.

@jason-kane
Copy link
Owner

jason-kane commented Apr 14, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants