[GUI] Attempting to import a "folder" instead of scripts causes GUI to hang.

Issue #14 resolved
Andrew Peterson repo owner created an issue

If you attempt to import a folder instead of a single script, we get the following backtrace:

File "e:\code\pycommand\pyshipcommand_gui\dialogs.py", line 237, in _fileSelectCB
self._callback(file)
File "e:\code\pycommand\pyshipcommand_gui\__init__.py", line 304, in do_import

s = self.cscript.importScript(scriptFile)
File "e:\code\pycommand\pyshipcommand_gui\cscripts.py", line 59, in importScript
with open(scriptfile) as f:

IOError: [Errno 13] Permission denied: 'E:\Code\pyCommand\example_scripts'

The code is obviously not doing any checks on the file existence of the desired import path and just trying to blindly read the "directory". We should either block the import of a directory path, or attempt to import all the script files within that path. Either or, we need to check whether the specified path is a directory or not.

Comments (3)

  1. Andrew Peterson reporter

    Changed GUI Clients import function to properly handle paths instead of just filenames. Specifying a path with import any valid script within that path. Single script imports are still supported.

    fixes issue 14

    → <<cset 28645f8334c7>>

  2. Log in to comment