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

'NoneType' object has no attribute 'project_file_name' #153

Open
ivanionut opened this issue Jan 3, 2025 · 3 comments
Open

'NoneType' object has no attribute 'project_file_name' #153

ivanionut opened this issue Jan 3, 2025 · 3 comments

Comments

@ivanionut
Copy link

Hi @jcberquist
something strange happens with ST4 when I perform the following actions:

  • cmd + p: to open a file
  • cmd + option + 2: to split the editor into two columns
  • (on the right column) cmd + p: to open a file
  • still on the right column: cmd + t to open a file in a new tab: At this point I get the error below and the split editor "crashes" and returns to a single column.

Here's the error stack trace:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 898, in on_load_async
    run_view_callbacks('on_load_async', view_id)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 741, in run_view_callbacks
    callback(v, *args)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 202, in exception_handler
    return event_handler(*args)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/cfml_plugin.py", line 16, in on_load_async
    events.trigger("on_load_async", view)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/events.py", line 13, in trigger
    callback(*event_args)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/buffer_metadata.py", line 110, in on_view_loaded
    get_view_metadata(view)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/buffer_metadata.py", line 76, in get_view_metadata
    project_name = utils.get_project_name(view)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/utils.py", line 27, in get_project_name
    project_file_name = view.window().project_file_name()
AttributeError: 'NoneType' object has no attribute 'project_file_name'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 898, in on_load_async
    run_view_callbacks('on_load_async', view_id)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 741, in run_view_callbacks
    callback(v, *args)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 202, in exception_handler
    return event_handler(*args)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/cfml_plugin.py", line 16, in on_load_async
    events.trigger("on_load_async", view)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/events.py", line 13, in trigger
    callback(*event_args)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/buffer_metadata.py", line 110, in on_view_loaded
    get_view_metadata(view)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/buffer_metadata.py", line 76, in get_view_metadata
    project_name = utils.get_project_name(view)
  File "/Users/ivanionut/Library/Application Support/Sublime Text/Installed Packages/CFML.sublime-package/src/utils.py", line 27, in get_project_name
    project_file_name = view.window().project_file_name()
AttributeError: 'NoneType' object has no attribute 'project_file_name'
@ivanionut
Copy link
Author

Hi @jcberquist ,
Do you have any ideas about this? Do you need any additional data that could help with debugging?

Or should I try to modify something in my project (some workaround) to temporarily fix this issue?

Thanks!

@jcberquist
Copy link
Owner

I don't use a Mac, so it would be helpful to know what exactly cmd + t is doing. In the default mac key binding file, the binding for cmd + p and cmd + t look exactly the same to me:

{ "keys": ["super+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["super+p"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },

Are you overriding the default key bindings?

That said, while I am not sure why the error that you show above causes the pane to crash, I should look into whether it can be avoided. It is an error I have seen myself, but since it wasn't causing any crashes, I haven't gotten around to looking into it.

@ivanionut
Copy link
Author

@jcberquist

Are you overriding the default key bindings?

These are the only customizations of Default.sublime-keymap:

[
    { "keys": ["super+k", "super+b"], "command": "toggle_sidebar_and_reveal_file" },

    {
        "keys": ["ctrl+shift+tab"],
        "command": "compass_show",
        "context": [
            { "key": "overlay_visible", "operator": "equal", "operand": false },
            { "key": "compass" },
        ]
    }
]

If it might be helpful, I can also make a screen video recording:
https://drive.google.com/file/d/1oK1f6FwDYIs5fa13wAZu0wvosc1-Uy7k/view?usp=sharing

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