kek91 / StatusBarExtended

Extend status bar in fman to show more information
MIT License
15 stars 2 forks source link

Squigly brackets in filename cause an error #22

Open Chaiavi opened 3 years ago

Chaiavi commented 3 years ago

When having a file with a squigly bracket in the filename "{" or "}", an error is raised:

DirectoryPaneListener 'StatusBarExtended' raised error.

Traceback (most recent call last):
  File "fman\impl\plugins\plugin.py", line 311, in _notify_listener_in_thread
  File "C:\Users\ahayun\AppData\Roaming\fman\Plugins\Third-party\StatusBarExtended\statusbarextended\__init__.py", line 144, in on_path_changed
    StatusBarExtended.refresh(self)
  File "C:\Users\ahayun\AppData\Roaming\fman\Plugins\Third-party\StatusBarExtended\statusbarextended\__init__.py", line 33, in refresh
    dir_files_in_dir      = glob.glob(current_dir + "/*")
  File "glob.py", line 20, in glob
  File "glob.py", line 71, in _iglob
  File "glob.py", line 72, in _iglob
  File "glob.py", line 83, in _glob1
  File "fnmatch.py", line 52, in filter
  File "fnmatch.py", line 46, in _compile_pattern
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\re.py", line 233, in compile
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\re.py", line 301, in _compile
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\sre_compile.py", line 562, in compile
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\sre_parse.py", line 855, in parse
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\sre_parse.py", line 416, in _parse_sub
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\sre_parse.py", line 765, in _parse
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\sre_parse.py", line 416, in _parse_sub
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python36-32\lib\sre_parse.py", line 553, in _parse
sre_constants.error: bad character range 2-0 at position 20
eugenesvk commented 3 years ago

Interesting, I don't have any issue with {} on Windows with fman 1.7.3 sbe-squiggly

Could you maybe share more details: full path name, fman version, full plugin settings file StatusBarExtended (Windows).json etc. Also, are you able to execute the same path + "/*" glob in a regular python session?

eugenesvk commented 3 years ago

you might have [] brackets with some extra symbols in the path name (not in the file name), seems like a known glob design limitation (https://bugs.python.org/issue738361), e.g. this [A--_B] crashes glob (and this plugin) on both Windows and macOS

eugenesvk commented 3 years ago

You might want to use this updated plugin version as a temporary fix before it's merged to the new release — I think I've escaped all the glob meta chars https://docs.python.org/3/library/glob.html properly, so it shouldn't crash or anything, but any additional testing is appreciated

Chaiavi commented 3 years ago

Uninstalled the previous version, then installed the plugin (all within fman)

But got the following error:



Traceback (most recent call last):
  File "urllib\request.py", line 1318, in do_open
  File "http\client.py", line 1239, in request
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "http\client.py", line 1026, in _send_output
  File "http\client.py", line 964, in send
  File "http\client.py", line 1392, in connect
  File "http\client.py", line 936, in connect
  File "socket.py", line 704, in create_connection
  File "socket.py", line 745, in getaddrinfo
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ahayun\AppData\Local\fman\Versions\1.7.3\Plugins\Core\core\github.py", line 76, in _get
    return urlopen(url).read()
  File "urllib\request.py", line 223, in urlopen
  File "urllib\request.py", line 532, in open
  File "urllib\request.py", line 642, in http_response
  File "urllib\request.py", line 564, in error
  File "urllib\request.py", line 504, in _call_chain
  File "urllib\request.py", line 756, in http_error_302
  File "urllib\request.py", line 526, in open
  File "urllib\request.py", line 544, in _open
  File "urllib\request.py", line 504, in _call_chain
  File "urllib\request.py", line 1361, in https_open
  File "urllib\request.py", line 1320, in do_open
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib\site-packages\urllib3\connection.py", line 159, in _new_conn
  File "lib\site-packages\urllib3\util\connection.py", line 57, in create_connection
  File "socket.py", line 745, in getaddrinfo
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
  File "lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request
  File "lib\site-packages\urllib3\connectionpool.py", line 839, in _validate_conn```
Chaiavi commented 3 years ago

Never mind, probably a fluke

It now succeeded installing it