Skip to content

Exception in the startup.py tries to open a random command line file #384

@andry81

Description

@andry81
  • PythonScript: 3.0.20.0

I have an extension to the Notepad++.
In the extension I have using the startup.py to parse an extra command line looking like this:

notepad++.exe -nosession -multiInst -z --custom_parameter_1 -z "<path-to-custom-file-list>" -z --custom_parameter_2 -z custom_parameter_3

The startup.py has a code:

...
with open(path_to_custom_file_list, 'rb') as file_list:
  ...
...

Which throws the exception:

FileNotFoundError: [Errno 2] No such file or directory: "<path-to-custom-file-list>"

This is ok, as long the file does not exist.

But, then Notepad++ tries to create a new file with the dialog box:


Create new file

"-z --custom_parameter_2 -z custom_parameter_3" doesn't exist. Create it?

Yes No

This is not expected. The Notepad++ should not proceed to open anything. Just open an empty tab instance would be enough.

I suspect the Notepad++ tries to detect the rest of the command line after a random file parameter as a path to a file.

Suggestion: May be command line cleanup in the default exception handler would be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions