Closed Pablo2m closed 3 years ago
Hi!
Sorry, I haven't really brought this to a stage where I was expecting others to try and install it.
I haven't used zk_web
since quite some time, it's quite likely that I broke this (meanwhile small graphs are included in the webserver view).
Let me see if I can offer a quick fix (but I'm quite busy at the moment unfortunately).
Some of your errors I just solved (but you worked around them already)
readline
dependencyutil
not recognized as a packageCan you install the latest version again?
So zk_web -o out.dot
works for me (and then you can use graphviz to turn it into a graph)
Thanks for replying, the setup.py file needs a little fix
E:\Zettelkasten\verzettler-master>python setup.py install
Traceback (most recent call last):
File "setup.py", line 26, in <module>
with (this_dir / "README.rst").open() as fh:
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1218, in open
return io.open(self, mode, buffering, encoding, errors, newline,
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1074, in _opener
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'E:\\Zettelkasten\\verzettler-master\\README.rst'
Ignoring that, the other error I see is that the vis-network.min file is not copied to its destination, in my case
C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\Lib\site-packages\verzettler-0.1.0-py3.8.egg\verzettler\html_resources\vis-network.min.js
Once I copied the zk_web command it worked, it's a nice visualization.
Now I'm seeing what I can do with get_zk_base_dirs_from_env ()
In order to run zk_server
Thanks for replying, the setup.py file needs a little fix
You're right of course! Forgot to update that
Ignoring that, the other error I see is that the vis-network.min file is not copied to its destination, in my case
Yeah, probably needs to be added to the manifest
Thanks for helping me work out all these issues! It's not thoroughly tested so there's probably a lot to do.
Now I'm seeing what I can do with get_zk_base_dirs_from_env () In order to run zk_server
Ah, right it currently doesn't let you specify the input directories manually...
also you'll need to have pandoc
installed to use the server thing
I mean what you could do as a quick workaround is to simply let get_zk_base_dirs_from_env
return ["/path/to/my/directory/"]
by modifying the source file
The real solution would of course be to copy the quick command line interface also to the server application. I might try to do that in the next few days, but kind of very busy, so let's see
Tonight I'll try to tweak the setup.py. I have made a small detour adding two lines to set ZK_HOME (for some strange reason it does not persist, I will try to investigate that this week). Even with those two things there is still a problem to run it on windows, I guess where the problem is but I have to do some tests in the interactive console to understand if I can solve it or not.
I am trying to understand a small problem, at first I thought it happened only in windows but I have managed to make it happen in ubuntu (using wsl2).
pablo2m@DESKTOP-B8QCU7E:/mnt/c/Users/Bios-PC/verzettler$ zk_server
* Serving Flask app "verzettler.bin.zk_server" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
DEBUG: Opening 00000000000000
ERROR: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.8/dist-packages/verzettler-0.1.0-py3.8.egg/verzettler/bin/zk_server.py", line 153, in root
return open(zk.root)
File "/usr/local/lib/python3.8/dist-packages/verzettler-0.1.0-py3.8.egg/verzettler/bin/zk_server.py", line 143, in open
converted = pandoc_converter.convert(note)
File "/usr/local/lib/python3.8/dist-packages/verzettler-0.1.0-py3.8.egg/verzettler/note_converter.py", line 290, in convert
ret = subprocess.run(
File "/usr/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pandoc'
127.0.0.1 - - [07/Oct/2020 10:52:44] "GET / HTTP/1.1" 500 -
127.0.0.1 - - [07/Oct/2020 10:52:47] "GET /favicon.ico HTTP/1.1" 404 -
and yet it was installed,
pip3 list
Package Version
pandoc 1.0.2
Then I discovered (I think you told me some of that) that its necessary to install it from the package manager and not from pip3.
pablo2m@DESKTOP-B8QCU7E:/mnt/c/Users/Bios-PC/verzettler$ zk_server
* Serving Flask app "verzettler.bin.zk_server" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
DEBUG: Opening 00000000000000
ERROR: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.8/dist-packages/verzettler-0.1.0-py3.8.egg/verzettler/bin/zk_server.py", line 153, in root
return open(zk.root)
File "/usr/local/lib/python3.8/dist-packages/verzettler-0.1.0-py3.8.egg/verzettler/bin/zk_server.py", line 145, in open
return render_template(
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/templating.py", line 138, in render_template
ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 869, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/usr/lib/python3/dist-packages/jinja2/loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/templating.py", line 60, in get_source
return self._get_source_fast(environment, template)
File "/usr/local/lib/python3.8/dist-packages/Flask-1.1.2-py3.8.egg/flask/templating.py", line 89, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: page.html
After moving the necessary files, in this case those in the template folder this error is solved, and another appears:
ERROR: Exception on / [GET]
Traceback (most recent call last):
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\verzettler-0.1.0-py3.8.egg\verzettler\bin\zk_server.py", line 153, in root
return open(zk.root)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\verzettler-0.1.0-py3.8.egg\verzettler\zettelkasten.py", line 92, in root
return _get_root(self._graph)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\verzettler-0.1.0-py3.8.egg\verzettler\zettelkasten.py", line 77, in _get_root
return min(g.nodes)
ValueError: min() arg is an empty sequence
And this far I can get, never use networkx and certain things I do not understand. When you have time, could you see it ?. I am using the playground directory for these tests
Hmmm, taking a quick look at this, this is a bug that happens if there are no nodes (notes) found. So here
@lru_cache(maxsize=100)
def _get_root(g: nx.DiGraph) -> str:
return min(g.nodes)
you have the minimum over an empty sequence.
Of course I could just return None
, but I'm not sure what this would break
Okay, I've added some command line things to the zk_server
.
So you should now be able to remove the workaround with the environment variables and use
zk_server -l d -i /path/to/verzettler/verzettler/tests/playground/
And if you click on the link that is shown, you should see this
So the bug with having zero notes is annoying, but it shouldn't actually happen if you correctly load from the playground directory. perhaps your workaround didn't work, can you try with the example call that I wrote?
Using the example command it loads correctly, thank you very much.
The zettel display, navigation and search (I'm not so sure about this, I feel like sometimes it behaves like I'm lucky when it isn't) work.
The integration with typora does not work, it seems a problem between windows and typora, I will analyze it.
The copying of the html, js and company files is pending, I will also see if I learn how to do it.
The reload command only reloads the directories in the environment variable, not the one specified on the command line, I think it could fix it
The dashboard is not working for me, this is what I get
[5 2]
[-0.5 0.5 1.5]
defaultdict(<class 'int'>, {'tests': 7})
ERROR: Exception on /dashboard [GET]
Traceback (most recent call last):
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\flask-1.1.2-py3.8.egg\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\verzettler-0.1.0-py3.8.egg\verzettler\bin\zk_server.py", line 79, in dashboard
zk_name_pie_chart(zk=zk),
File "C:\Users\Bios-PC\AppData\Local\Programs\Python\Python38\lib\site-packages\verzettler-0.1.0-py3.8.egg\verzettler\bokeh_plots.py", line 78, in zk_name_pie_chart
data["color"] = Reds[len(x)]
KeyError: 1
127.0.0.1 - - [08/Oct/2020 10:42:07] "GET /dashboard HTTP/1.1" 500 -
I read in the code, after adding some notes just in case (line 77 of bokeh_plots says # fixme: problems if we have <= 2 zks) the error persists
I will take a look at this tomorrow! You can probably also just disable the problematic plot...
Yes, it was trivial to disable that plot.
Great!
Btw, I think in the longer term we might also want to get rid of bokeh and use plotly instead. Just so much easier to use I think
But I think it makes sense to close this issue now and rather make separate issues for things that need fixing.
Thanks!
Hello, I am trying to install it in windows, I have not succeeded yet, and I need your help with a function but I will tell you about the process in case it works for someone else, at first I thought that everything had worked well, since the installation using "python setup.py install" did not mark any error. But then when running it
This library is not available, fortunately there is a replacement
A second try showed another error
Strangely, the two files inside the \ verzettler \ util folder are not copied, that is easily solved Now we come to the problem that I can't solve
I've been looking everywhere and I can't find that function / attribute ('dot_graph'), am I doing something wrong? Could you help me? Thank you in advance