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

KeyError: 'has_project' (Windows 10) #7

Closed
ksere opened this issue May 13, 2018 · 5 comments
Closed

KeyError: 'has_project' (Windows 10) #7

ksere opened this issue May 13, 2018 · 5 comments

Comments

@ksere
Copy link

ksere commented May 13, 2018

Hi, getting this with 1.3.2 ( Sublime 3.0.3170 on Windows 10 ).

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 611, in on_activated_async
    callback.on_activated_async(v)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 118, in on_activated_async
    self.run(view)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 136, in run
    new_title = get_new_title(view, project, settings)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 239, in get_new_title
    new_title = template.format(path=path, project=project)
KeyError: 'has_project'

Same error when using the default config file included in the release.

Cheers

@gwenzek
Copy link
Owner

gwenzek commented May 13, 2018

Hi, thanks for reporting.
I think I have a fix for this somewhere but that I haven't pushed it.
I'm gonna look into this this week.

gwenzek pushed a commit that referenced this issue May 17, 2018
@gwenzek
Copy link
Owner

gwenzek commented May 17, 2018

I think what triggered the bug is the handling of {project} outside of a project when {has_project_false} is empty.

Can you try to set "has_project_false" settings to "()" or something else to see if the bug still happens ?
If that fix the bug then my last commit should work, please try it if you can, otherwise I'll just publish a new release.

@gwenzek
Copy link
Owner

gwenzek commented May 21, 2018

I created a new release with the fix, tell me if the issue persists.

@ksere
Copy link
Author

ksere commented May 21, 2018

Hi,

Sorry I hadn't got around to testing with "has_project_false" settings to "()".

I just tested with 1.3.3 and getting this:

reloading plugin SetWindowTitle.set_window_title
reloading settings Packages/SetWindowTitle/set_window_title.sublime-settings
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 611, in on_activated_async
    callback.on_activated_async(v)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 118, in on_activated_async
    self.run(view)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 137, in run
    self.rename_window(view.window(), official_title, new_title, settings)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 164, in rename_window
    self.rename_window_windows(window, official_title, new_title)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 203, in rename_window_windows
    for w in Window.list_all():
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 69, in list_all
    return [cls(handle) for handle in handles]
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 69, in <listcomp>
    return [cls(handle) for handle in handles]
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 36, in __init__
    self.init_user32()
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 75, in init_user32
    cls.u.EnumWindows.restype = cls.c.c_bool
AttributeError: type object 'Window' has no attribute 'c'
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 233, in synthesize_on_activated_async
    el.on_activated_async(v)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 118, in on_activated_async
    self.run(view)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 137, in run
    self.rename_window(view.window(), official_title, new_title, settings)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 164, in rename_window
    self.rename_window_windows(window, official_title, new_title)
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 203, in rename_window_windows
    for w in Window.list_all():
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 69, in list_all
    return [cls(handle) for handle in handles]
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 69, in <listcomp>
    return [cls(handle) for handle in handles]
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 36, in __init__
    self.init_user32()
  File "C:\Users\kse\AppData\Roaming\Sublime Text 3\Installed Packages\SetWindowTitle.sublime-package\set_window_title.py", line 75, in init_user32
    cls.u.EnumWindows.restype = cls.c.c_bool
AttributeError: type object 'Window' has no attribute 'c'

And also getting the same error when setting "has_project_false" settings to "()".

No hurry for me, I will install manually the last working version.
Thanks for looking into it and let me know if there is anything else I can help you test.

@gwenzek
Copy link
Owner

gwenzek commented May 28, 2018

Ok this seems to be specific to Windows and unrelated.
I'm opening #8 to track this.

@gwenzek gwenzek closed this as completed May 28, 2018
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