jason-kane/PyYapf

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

Opened this issue · 1 comments

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.