Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag search is not working #51

Closed
pkritiya opened this issue Mar 10, 2018 · 16 comments
Closed

Tag search is not working #51

pkritiya opened this issue Mar 10, 2018 · 16 comments

Comments

@pkritiya
Copy link

I did a manual install as automatic installation is not working. With the current version I downloaded, tag search #!, #? is not working - it worked before (when I first tried), but it stopped working now since I reinstalled sublime_zk

@renerocksai
Copy link
Owner

OK, I will need a bit more information to get a sense of what is going on on your end:

  • why have you re-installed? (when it was working before)
  • have you re-installed something different? a different version, into a different directory...?
  • or is it quite a while ago that you first tried?
  • do you have ag installed? I don't recommend the pre-ag era implementation of searches, so I highly recommend installing ag.
  • are you on Windows, Linux, Mac?

I just checked and see some troubles with the tag-search when ag is not installed. I should be able to fix it.

I can help more when you:

  • bring up the console in SublimeText by pressing CTRL+`
  • then try a tag search

and then send me the output of the console. If tag search isn't working, it is likely that the console shows a few error messages.

@renerocksai
Copy link
Owner

Hi, there were indeed issues with the code for tag searches when not using ag. I hadn't touched it probably since I started using ag.

If you update to the latest commit, tag search should work as expected.

Please let me know if this fixed it for you. I assume you don't have ag installed.

@renerocksai
Copy link
Owner

I am closing this for now, please re-open if your problem still exists

@pkritiya
Copy link
Author

I'm using Mac, and have ag installed.
when bring up the console, and tried a tag search, I have this message: SyntaxError: unexpected EOF while parsing.

reloading plugin sublime_zk-master.sublime_zk
plugins loaded
Initializing 1self plugin
Traceback (most recent call last):
File "./python3.3/urllib/request.py", line 1248, in do_open
File "./python3.3/http/client.py", line 1065, in request
File "./python3.3/http/client.py", line 1103, in _send_request
File "./python3.3/http/client.py", line 1061, in endheaders
File "./python3.3/http/client.py", line 906, in _send_output
File "./python3.3/http/client.py", line 844, in send
File "./python3.3/http/client.py", line 822, in connect
File "./python3.3/socket.py", line 417, in create_connection
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 210, in on_api_ready
m.plugin_loaded()
File "1self in /Users/juhyun/Library/Application Support/Sublime Text 3/Installed Packages/1Self.sublime-package", line 58, in plugin_loaded
File "1self in /Users/juhyun/Library/Application Support/Sublime Text 3/Installed Packages/1Self.sublime-package", line 65, in after_loaded
File "1self in /Users/juhyun/Library/Application Support/Sublime Text 3/Installed Packages/1Self.sublime-package", line 135, in get_stream_id_if_not_present
File "./python3.3/urllib/request.py", line 156, in urlopen
File "./python3.3/urllib/request.py", line 469, in open
File "./python3.3/urllib/request.py", line 487, in _open
File "./python3.3/urllib/request.py", line 447, in _call_chain
File "./python3.3/urllib/request.py", line 1274, in http_open
File "./python3.3/urllib/request.py", line 1251, in do_open
urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
Sublime_ZK: Using /usr/local/bin/ag
environment variables loaded using: /bin/bash -l
Package Control: Skipping automatic upgrade, last run at 2018-03-10 22:22:53, next run at 2018-03-10 23:22:53 or after
reloading settings Packages/User/Preferences.sublime-settings

#qn
File "", line 1
#qn
^
SyntaxError: unexpected EOF while parsing

@renerocksai
Copy link
Owner

Your setup looks a bit messed up. I can see you installed probably from a .ZIP. I would move the sublime_zk folder one level up, but that's not causing your issues.

Initializing 1self plugin
Traceback (most recent call last):
File "./python3.3/urllib/request.py", line 1248, in do_open
...

There's another plugin, maybe called 1Self, that tries to make an HTTP request but seems to be misconfigured, hence the socket.gaierror: [Errno 8] nodename nor servname provided, or not known error message.

Sublime_ZK loads correctly and reports the path to ag:

Sublime_ZK: Using /usr/local/bin/ag

Since you're using ag, tag search should not be a problem at all.

I don't know where this comes from :

environment variables loaded using: /bin/bash -l

and then we have package control:

Package Control: Skipping automatic upgrade, last run at 2018-03-10 22:22:53, next run at 2018-03-10 23:22:53 or after

After that you can clearly see that you have some garbage in your user preferences:

reloading settings Packages/User/Preferences.sublime-settings
> > > #qn
> > > File "", line 1
> > > #qn
> > > ^
> > > SyntaxError: unexpected EOF while parsing

So maybe start there first: remove the garbage from your User Preferences:

  • SublimeText > Preferences > Settings

Comments in settings (JSON) files start with //, not #. So in your case, remove the line #qn and check the rest for similar errors. SublimeText won't let me save preferences files that contain syntax errors, so I recommend editing them within SublimeText.

And maybe remove or configure that 1self plugin, maybe after all this, SublimeText and Sublime_ZK will work without problems.

@pkritiya
Copy link
Author

pkritiya commented Mar 10, 2018

  • Oh, thank you so much for your help.
  • I have deleted 1self thing - I don't know where this thing come from.
  • I also cleared those garbages in my preferences as you suggested.
  • Now, I think I know where this problem comes from. Some tags were written in Korean, and I have this error.

yntaxError: unexpected EOF while parsing
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 818, in run_
return self.run(edit)
File "/Users/hyun/Library/Application Support/Sublime Text 3/Packages/sublime_zk-master/sublime_zk.py", line 1583, in run
self.tags = find_all_tags_in(folder, extension)
File "/Users/hyun/Library/Application Support/Sublime Text 3/Packages/sublime_zk-master/sublime_zk.py", line 944, in find_all_tags_in
return ExternalSearch.search_all_tags(folder, extension)
File "/Users/hyun/Library/Application Support/Sublime Text 3/Packages/sublime_zk-master/sublime_zk.py", line 523, in search_all_tags
extension, tags=True)
File "/Users/hyun/Library/Application Support/Sublime Text 3/Packages/sublime_zk-master/sublime_zk.py", line 596, in search_in
return ExternalSearch.run(args, folder)
File "/Users/hyun/Library/Application Support/Sublime Text 3/Packages/sublime_zk-master/sublime_zk.py", line 620, in run
return output.decode('utf-8').replace('\r', '')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xec in position 34: invalid continuation byte

Do you think sublime_zk can support non English language for tagging? Before I also had a problem with Korean titles which I therefore changed to English titles. I will delete Korean tags and see if problem continues.

Thank you very much for your help - and also for this super wonderful program!!!!

@renerocksai
Copy link
Owner

Awesome! Yeah, now we're getting close!

This is definitely some utf8 encoding / decoding issue. We should get that to work. I will dig into this!

Thanks for sharing that, now we have a Korean use case to test 😁

I might need your help testing...

If ag complains, we can always use the bit slower python search...

Send me a Korean tag if you like, I would love to test this on my Mac 😀

@pkritiya
Copy link
Author

Definitely the problem is caused by Korean tags - I created a new project that has no Korean tags and the search works perfectly.

I just copied some Korean tags for you to work with

#행복 #안녕하세요 #서브라임 #사회 #사회란무엇인가

Thanks for your quick reply!!

@pkritiya
Copy link
Author

The thing I forgot mentioning is that Korean tags worked before - that's why I started using them.
Suddenly it stopped working from few days ago.

@renerocksai
Copy link
Owner

Cool that we're now down to the root cause. And thanks a lot for the tags to play with. I will check what can be done ...

@renerocksai
Copy link
Owner

I recall having changed some of the tag code recently, I probably introduced the bug as a side-effect. We'll get it to work... 😀

@renerocksai
Copy link
Owner

Hi, I just pushed a fix! At least it works with the tags you provided. Apparently, according to python's unicode module, your tags contain unexpected bytes at the end, so I now ignore them. What's interesting: It works. Even searching for notes tagged by tags from the tag list (first #!, then ctrl+enter on a Korean tag in the tag list) works. The tags in the tag list are the result of stripping the extra bytes. But they still match the original tags.

Unicode is mysterious, sometimes.

@renerocksai
Copy link
Owner

What do your sample tags mean, btw? I am curious 😄

@pkritiya
Copy link
Author

Amazing! It works!!! Thank you so much. I am very happy I can use Korean tags now - it was a bit of troublesome to translate all these tags I used to the English ones. Don't know how to say thank you for your GREAT works. Thank you!

Btw, these tags means #happiness #Hello #Sublime #Society #What is society :)

@renerocksai
Copy link
Owner

You're welcome! Thank you for bringing this up! Now all non-English character-set users will benefit thanks to you! 👍

😄 I like your tags, especially the first one 😄

I changed the unicode handling everywhere, so, ideally it should work with Auto-TOC, too, and even Auto-Bib 😄 #행복

@pkritiya
Copy link
Author

Oh, I just made these tags for you to try. My note tags are more serious ones than #hello :) By the way, I tried with note titles in Korean too - it seems it works as well. I should thank you for this too!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants