sioyek-python-extensions
sioyek-python-extensions copied to clipboard
clean_path missing in python package for rect_string
Hello,
add_text and remove_annotations did not work for me. I had to modify
rect_string = sys.argv[5]
to
rect_string = clean_path(sys.argv[5])
in order for the plugins to work. Otherwise, I get
line 7, in parse_rect
page = int(parts[0])
^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '"2'
I had that same problem. Solved it by removing the quotes '"' around %{selected_rect} , %{command_text} and in your case would be around %{file_path} as well in the commands in the prefs_user.config file as they where not being filtered out in the script while they are being parsed in python.
The biggest give away was the " in the error before the '"2'
this happens because, for some reason, the rectangle size and added text are not parsed as clean strings which keeps a \" in the begining and end of these arguemnts, which are present in the argument in the prefs_user.config file.
This is the add_text.py
if __name__ == '__main__':
SIOYEK_PATH = clean_path(sys.argv[1])
LOCAL_DATABASE_PATH = clean_path(sys.argv[2])
SHARED_DATABASE_PATH = clean_path(sys.argv[3])
FILE_PATH = clean_path(sys.argv[4])
rect_string = sys.argv[5]
added_text = sys.argv[6]
+1 Solved my problem too