ihdavids / orgextended

Sublime Text OrgMode Extension
MIT License
205 stars 15 forks source link

fail in executing Capture #70

Open jimzhuang opened 1 year ago

jimzhuang commented 1 year ago

Describe the bug the Capture function doesn't work for v1.2.52

To Reproduce Steps to reproduce the behavior: Alt+o,z -> enter capture then nothing happened

Expected behavior a panel of Capture should pop up

Screenshots n/a

Platform:

Sublime debug console output Traceback (most recent call last): File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgcapture.py", line 471, in on_done_base_st4 File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgcapture.py", line 469, in on_done_base_st3 File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgcapture.py", line 686, in on_done File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgcapture.py", line 76, in GetCapturePath File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgcapture.py", line 47, in GetCaptureFile File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgcapture.py", line 41, in GetDict File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgdaypage.py", line 57, in dayPageGetName File "C:\Users\abc\AppData\Roaming\Sublime Text\Installed Packages\OrgExtended.sublime-package\orgdaypage.py", line 41, in dayPageGetPath File "./python3.3/os.py", line 246, in makedirs File "./python3.3/ntpath.py", line 231, in split TypeError: Can't convert 'list' object to str implicitly

Additional context use default settings

ihdavids commented 1 year ago

Thank you for reporting this. Looks like it is the symbol expansion code during template evaluation. You can probably work around this if you define a daypagepath symbol (for the worklog/diary system)

I will get a fix in place as soon as i can make time Ian

ihdavids commented 1 year ago

A fix should be in 1.2.53. I found the culprit.

Although, it is possible you might have a list in your configuration file for your dayPagePath, which isn't valid. IE: dayPagePath: "c:/mypath/",

should not be: dayPagePath: ["c:/mypath"],

Looks like I need to up my testing efforts. It seems like I have some real users now of the package as people are finding bugs and since I have been the only real user of the package till now I have tended to be a little lax in my testing. Thanks for finding this.

jimzhuang commented 1 year ago

Thank you, Davids. After removing the brackets, the "cache" window pops up. This package is really helpful for me to practice GTD. :-)

jimzhuang commented 1 year ago

One more thing about this issue: if there are blanks in the folder name, the refile.org can't be saved. That is: the folder of "refile": "D:/My Personal Documents/My Notes/refile.org" doesn't work, however "refile": "D:/refile.org" works.

ihdavids commented 1 year ago

Hmmm, I can get spaces working do you have the exception?

I noticed that if the path doesn't exist it does throw an exception. I have fixed that in 1.2.53

ihdavids commented 1 year ago

1.2.53 has been pushed.

Daemsen commented 1 year ago

I have the same issue. Writing from Panel into /Users/xxx/Desktop/refile.org works. But if it try to use a path witch spaces (in this case it is an iCloud folder, which works for all other .org files) i get the following error in the console:

2023-01-12 10:38:09,656 - DEBUG - TEMPLATE: 2023-01-12 10:38:09,657 - DEBUG - TEMPLATE: 2023-01-12 10:38:09,657 - DEBUG - TEMPLATE: 2023-01-12 10:38:09,657 - DEBUG - TEMPLATE: Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 948, in on_deactivated run_view_callbacks('on_deactivated', view_id) File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 708, in run_view_callbacks callback(v, args) File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 152, in profiler return event_handler(args) File "/Users/Damian/Library/Application Support/Sublime Text 3/Packages/OrgExtended/orgextended.py", line 113, in on_deactivated capture.onDeactivated(view) File "/Users/Damian/Library/Application Support/Sublime Text 3/Packages/OrgExtended/orgcapture.py", line 198, in onDeactivated target, capturePath, captureFile, at, toinsert = GetCapturePath(GetViewById(view.settings().get('cap_view')), template) File "/Users/Damian/Library/Application Support/Sublime Text 3/Packages/OrgExtended/orgcapture.py", line 76, in GetCapturePath filename = GetCaptureFile(view, template, target) File "/Users/Damian/Library/Application Support/Sublime Text 3/Packages/OrgExtended/orgcapture.py", line 47, in GetCaptureFile filename = templateEngine.ExpandTemplate(view, target[1], GetDict(), sets.Get)[0] File "/Users/Damian/Library/Application Support/Sublime Text 3/Packages/OrgExtended/orgutil/template.py", line 62, in ExpandTemplate "file": str(view.file_name()), AttributeError: 'NoneType' object has no attribute 'file_name' 2023-01-12 10:38:36,617 - DEBUG - CHECKING...

ihdavids commented 1 year ago

As you can tell. I dont use spaces in my paths. :) The panel has always been somewhat temperamental, i really hate that code, but the sublime api is a little limited. I will see if i can make time to sort that out at some point.

Daemsen commented 1 year ago

Thanks! Now that I use a directory without blanks, it works just fine for me. I think using the panel (from a user perspective ;)) is handy.

ihdavids commented 1 year ago

Heh. Yes. I thought the panel would be handy as well, but ultimately found its klunkyness irritated me.