sobjornstad / TiddlyRemember

Embed Anki notes in your TiddlyWiki
https://sobjornstad.github.io/TiddlyRemember/
MIT License
66 stars 7 forks source link

Import error #6

Closed sortega closed 4 years ago

sortega commented 4 years ago

First of all, I want to thank you for creating this plugin. I think it's an amazing idea to bridge tiddlywiki and Anki and I'm eager to try it.

However, I get this error when trying to syncronize:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.24 (359b9f5c) Python 3.8.0 Qt 5.13.1 PyQt 5.14.1
Platform: Mac 10.15.4
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-05-28 20:46:42
Add-ons possibly involved: ⁨TiddlyRemember⁩

Caught exception:
Traceback (most recent call last):
  File "/Users/sortega/Library/Application Support/Anki2/addons21/60456529/twimport.py", line 57, in _invoke_tw_command
    proc = subprocess.run(cmd, cwd=wiki_path, stdout=subprocess.PIPE,
  File "subprocess.py", line 512, in run
subprocess.CalledProcessError: Command '['/Users/sortega/opt/tiddlywiki/node_modules/.bin/tiddlywiki', '--output', '/var/folders/s3/9dx35k0d15z32c5hm51hwr980000gn/T/tmpvzlti1ox/render', '--render', '[type[text/vnd.tiddlywiki]] [type[]] +[!is[system]]', '[encodeuricomponent[]addsuffix[.html]]', 'text/html', '$:/plugins/sobjornstad/TiddlyRemember/templates/TiddlyRememberParseable']' returned non-zero exit status 7.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sortega/Library/Application Support/Anki2/addons21/60456529/__init__.py", line 141, in join_thread
    raise self.extract_thread.exception
  File "/Users/sortega/Library/Application Support/Anki2/addons21/60456529/__init__.py", line 59, in run
    self.notes = twimport.find_notes(
  File "/Users/sortega/Library/Application Support/Anki2/addons21/60456529/twimport.py", line 186, in find_notes
    _render_wiki(tw_binary, wiki_folder, render_location, filter_)
  File "/Users/sortega/Library/Application Support/Anki2/addons21/60456529/twimport.py", line 143, in _render_wiki
    _invoke_tw_command(cmd, wiki_path, "render wiki")
  File "/Users/sortega/Library/Application Support/Anki2/addons21/60456529/twimport.py", line 68, in _invoke_tw_command
    raise Exception(f"Failed to {description}: return code {proc.returncode}.\n"
Exception: Failed to render wiki: return code 7.
$ /Users/sortega/opt/tiddlywiki/node_modules/.bin/tiddlywiki --output /var/folders/s3/9dx35k0d15z32c5hm51hwr980000gn/T/tmpvzlti1ox/render --render [type[text/vnd.tiddlywiki]] [type[]] +[!is[system]] [encodeuricomponent[]addsuffix[.html]] text/html $:/plugins/sobjornstad/TiddlyRemember/templates/TiddlyRememberParseable

$:/plugins/chanilino/viz/lite.render.js:7
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="

ReferenceError: document is not defined
    at Object.$tw.utils.domMaker (/Users/sortega/opt/tiddlywiki/node_modules/tiddlywiki/boot/boot.js:160:32)
    at VizWidget.create ($:/plugins/chanilino/viz/vizWidget.js:55:33)
    at VizWidget.render ($:/plugins/chanilino/viz/vizWidget.js:19:28)
    at ElementWidget.Widget.renderChildren ($:/core/modules/widgets/widget.js:390:15)
    at ElementWidget.render ($:/core/modules/widgets/element.js:49:7)
    at TranscludeWidget.Widget.renderChildren ($:/core/modules/widgets/widget.js:390:15)
    at TranscludeWidget.render ($:/core/modules/widgets/transclude.js:33:7)
    at ImportVariablesWidget.Widget.renderChildren ($:/core/modules/widgets/widget.js:390:15)
    at ImportVariablesWidget.render ($:/core/modules/widgets/importvariables.js:33:7)
    at SetWidget.Widget.renderChildren ($:/core/modules/widgets/widget.js:390:15)

It happens regardless of where the wiki is (either in an URL, or as local file). I've tried to run the render command myself and I get the same error:

/Users/sortega/opt/tiddlywiki/node_modules/.bin/tiddlywiki --output /tmp/render1 --render '[type[text/vnd.tiddlywiki]] [type[]] +[!is[system]] [encodeuricomponent[]addsuffix[.html]]' text/html '$:/plugins/sobjornstad/TiddlyRemember/templates/TiddlyRememberParseable'
$:/plugins/chanilino/viz/lite.render.js:7
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="

Any idea?

sobjornstad commented 4 years ago

It looks like the chanilino/viz plugin is throwing an error, in your second line:

$:/plugins/chanilino/viz/lite.render.js:7

I don't know what this plugin does or why it would be interfering with rendering a wiki. Can you try disabling or removing the plugin and see if that helps?

sortega commented 4 years ago

That's a plugin rendering grapviz diagrams.

After disabling it and fixing a couple tiddlers with pathologically long names I got it working.

Many thanks