BasilPH / vizel

Zettelkasten visualization and stats🤩🗒
GNU General Public License v3.0
59 stars 5 forks source link

Improper Matching of Filenames #22

Open TheCedarPrince opened 4 years ago

TheCedarPrince commented 4 years ago

Hi @BasilPH

I think we have taken a good step forward, but also a small step backwards! I tested out the latest version you wanted me to test (0.2.0rc1) and I got the following stack trace error:

No matching Zettel for reference "03102020015817-aeonium-tabuliforme.jpg" in 03092020022908-education-spectrum.md
No matching Zettel for reference "03092020071146-context-aware) (click for more information" in 03092020035135-kidd-aware-home.md
No matching Zettel for reference "03102020050115-covid19-jhu-arcgis.jpg" in 03102020051547-sars-cov-2.md
No matching Zettel for reference "03102020061429-wfdb-file-format.md" in 03102020055416-reflection-00001.md
No matching Zettel for reference "LINK" in 03192020013253-bullet-journal.md
No matching Zettel for reference "03192020035441-bullet-journal-daily.md##Short-Form-Journaling-Symbols" in 03192020035337-bullet-journal-weekly.md
No matching Zettel for reference "03182020054832-gtd-flowchart.jpg" in 03192020050207-gtd-implementation.md
No matching Zettel for reference "LINK" in 03212020233348-problem-science.md
No matching Zettel for reference "https://d3js.org/" in 03232020025753-wn13-2020.md
No matching Zettel for reference "LINK" in 03232020134624-fulfillment-law.md
No matching Zettel for reference "LINK" in 03232020235136-electrodermal-activity.md
No matching Zettel for reference "1, 1], [1, -1" in 03272020050924-discrete-haar.md
No matching Zettel for reference "LINK" in 03272020050924-discrete-haar.md
No matching Zettel for reference "1585295721254.png" in 03272020064312-exponential-smoothing.md
No matching Zettel for reference "LINK" in 03292020142141-divorce.md
No matching Zettel for reference "LINK" in 03292020221326-what-mental-models.md
No matching Zettel for reference "LINK" in 03302020005409-note-criteria.md
No matching Zettel for reference "LINK" in 04072020211841-remem-assumptions.md
No matching Zettel for reference "04092020162632-skin-response.md) (click links to see definitions of both" in 04092020153616-eda-biomarker.md
No matching Zettel for reference "LINK" in 04092020161622-skin-conductance.md
No matching Zettel for reference "LINK" in 04092020162632-skin-response.md
No matching Zettel for reference "04092020161622-skin-conductance.md) (click link to see what the SCL is" in 04092020162632-skin-response.md
No matching Zettel for reference "LINK" in 04222020151920-linear-theorem.md
No matching Zettel for reference "LINK" in 04222020154543-data-fusion.md
No matching Zettel for reference "04252020025710.png" in 04252020024813-median-filtering.md
No matching Zettel for reference "3, 3, 2], [6, 3, 2], [5, 7, 0.6" in 04272020202443-matplotlib-box.md
No matching Zettel for reference "1588019308730.png" in 04272020202443-matplotlib-box.md
No matching Zettel for reference "03092020022908-education-spectrum.md) (pg. 56" in 05032020155207-fabrication-serendipity.md
No matching Zettel for reference "LINK" in 05042020212634-allostatic-load.md
No matching Zettel for reference "LINK" in 05092020053727-incremental-learning.md
No matching Zettel for reference "1589148887796.png" in 05102020220941-leitner-system.md
No matching Zettel for reference "1589148898324.png" in 05102020220941-leitner-system.md
No matching Zettel for reference "1589254962684.png" in 05112020034914-wn20-2020.md
No matching Zettel for reference "https://unsplash.com/@alfonsmc10" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "https://www.dropbox.com/" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "https://nextcloud.com" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "https://www.zotero.org/support/" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "http://zotfile.com" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "/assets/Taming Knowledge/zotfile_guide.pdf" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "zotfile.com" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "/assets/Taming Knowledge/npjschz201530.pdf" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "https://www.foxitsoftware.com/pdf-reader/) because 1) Has a wide assortment of tools and is very easy to work with once you get the hang of it 2) has a mobile app for the iPhone 3" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "https://joplinapp.org" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "/assets/favicon.ico" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "/assets/150x_profile.png" in 05162020023329-primer-eda-article.md
No matching Zettel for reference "https://unsplash.com/@alfonsmc10" in 05162020023355-creating-serendipity-article.md
No matching Zettel for reference "03092020022908-education-spectrum.md) (pg. 56" in 05162020023355-creating-serendipity-article.md
No matching Zettel for reference "03192020035441-bullet-journal-daily.md##Short-Form-Journaling-Symbols" in 05162020023355-creating-serendipity-article.md
No matching Zettel for reference "03182020054832-gtd-flowchart.jpg" in 05162020023355-creating-serendipity-article.md
No matching Zettel for reference "/assets/150x_profile.png" in 05162020023355-creating-serendipity-article.md
Traceback (most recent call last):
  File "/home/src/Programs/Miniconda3/bin/vizel", line 8, in <module>
    sys.exit(main())
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/vizel/cli.py", line 176, in stats
    digraph = _get_digraph(directory)
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/vizel/cli.py", line 110, in _get_digraph
    for reference_zettel_filename in _load_references(zettel_path, zettel_directory_path):
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/vizel/cli.py", line 64, in _load_references
    references += _extract_valid_references('\[\[(.+)\]\]', zettel_path, zettel_filenames)
  File "/home/src/Programs/Miniconda3/lib/python3.7/site-packages/vizel/cli.py", line 26, in _extract_valid_references
    zettel_text = zettel_file.read()
  File "/home/src/Programs/Miniconda3/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 1881: invalid start byte

I believe the error is coming from the fact that my Zettelkasten directory contains files other than strictly markdown files. As such, these files pass the logic in your _extract_valid_references function accidentally and trigger an error when attempting to be run by the rest of vizel. I also see website links being detected in the stacktrace as a zettel as well -- not sure why.

Again, I'd be happy to test things out and continue helping with updates/changes. Thanks @BasilPH!

BasilPH commented 4 years ago

Thank you for creating the issue @TheCedarPrince.

I'm looking into the Decoding error in #24.

I'm treating all types of markdown links as references, I'll think about limiting to links that point to txt or md files. Looking at the output that you posted, where you expecting these links below to work?

I'm asking so that I can figure out if I detect links correctly or not.

TheCedarPrince commented 4 years ago

Hey @BasilPH ,

In respect to those two points:

  1. No, that was an error on my part.
  2. I do expect this to work, so I am not sure what is going wrong here. When I click the link in the file, it does connect me to the proper markdown file.

I'll continue to look into this issue as well as issue #24 .