AstraLuma / xontrib-z

Tracks your most used directories, based on 'frecency'.
GNU General Public License v3.0
24 stars 16 forks source link

How to use 'z' : Getting ValueError #1

Closed mandarvaze closed 7 years ago

mandarvaze commented 7 years ago

I assumed since this is a port of z, I just do z dirname but it lead to a crash

mandar@MacBook-Pro ~ $ z src
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9468, in wrapped_simple_command
    r = f(args, i)
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 197, in handler
    return cls()(args, stdin)
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 141, in __call__
    data = list(self.load_data())
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 89, in load_data
    r = int(r)
ValueError: invalid literal for int() with base 10: '4.28733'

After that, normal cd also leads to this error (although cd itself works)

mandar@MacBook-Pro ~ $ cd /tmp
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 205, in cd_handler
    self.add(self.getpwd())
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 177, in add
    data = list(self.load_data())
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 89, in load_data
    r = int(r)
ValueError: invalid literal for int() with base 10: '4.28733'
mandar@MacBook-Pro /tmp $

In case it matters, I am on xonsh/0.4.5 on OSX

AstraLuma commented 7 years ago

I guess that's a bug in the underlying data layer.

This should be fixed in HEAD. I'm due for a release anyways. If you feel like pulling down and trying it, I'd be much obliged.

mandarvaze commented 7 years ago

I confirm that the changes in HEAD resolve the issue Waiting for the next release.

mandarvaze commented 7 years ago

Currently there is no data under releases tab

Will you be adding the release tags, and preferably CHANGELOG along with it ?

AstraLuma commented 7 years ago

I should do a changelog.

But yes, there will be git tags when I make it.

AstraLuma commented 7 years ago

Release made. If I don't hear in the next few days, I'm going to assume this is fixed.

mandarvaze commented 7 years ago

Upgraded using pip3 install --upgrade xontrib-z

Now on xontrib load z I get the following error:

mandar@MacBook-Pro /tmp $ xontrib load z
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9468, in wrapped_simple_command
    r = f(args, i)
  File "/usr/local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9902, in xontribs_main
    return _MAIN_XONTRIB_ACTIONS[ns.action](ns)
  File "/usr/local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9823, in _load
    update_context(name, ctx=ctx)
  File "/usr/local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9805, in update_context
    modctx = xontrib_context(name)
  File "/usr/local/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 9790, in xontrib_context
    m = importlib.import_module(spec.name)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/usr/local/lib/python3.5/site-packages/xontrib/z.py", line 208, in <module>
    @events.on_chdir
NameError: name 'events' is not defined
AstraLuma commented 7 years ago

You have to upgrade to the latest xonsh, too.

mandarvaze commented 7 years ago

Thanks. Problem solved after upgrading to xonsh 0.4.6

Can you put the xonsh version as a dependency in pip, so that it will automatically upgrade xonsh (or complain and exit)

AstraLuma commented 7 years ago

Yeah, I should do that on all my xontribs.