wting / autojump

A cd command that learns - easily navigate directories from the command line
Other
16.2k stars 706 forks source link

invalid literal for float() #463

Open yuhongzhi opened 7 years ago

yuhongzhi commented 7 years ago

File "/home/X/.autojump/bin/autojump", line 320, in sys.exit(main(parse_arguments())) File "/home/X/.autojump/bin/autojump", line 264, in main save(config, first(add_path(load(config), args.add))) File "/home/X/.autojump/bin/autojump_data.py", line 83, in load ifilter(correct_length, imap(parse, f)))) File "/home/X/.autojump/bin/autojump_data.py", line 73, in tupleize = lambda x: (x[1], float(x[0])) ValueError: invalid literal for float(): 17.32050817.3205080757

wangwpf commented 7 years ago

I have encountered this problem, is there a solution? OS: Ubuntu 12.04 python: 2.7.3 shell: zsh

ampedandwired commented 7 years ago

Same here:

Traceback (most recent call last):
  File "/usr/bin/autojump", line 420, in <module>
    sys.exit(main(parse_arguments()))
  File "/usr/bin/autojump", line 392, in main
    entries = entriefy(load(config))
  File "/usr/share/autojump/autojump_data.py", line 81, in load
    ifilter(correct_length, imap(parse, f))))
  File "/usr/share/autojump/autojump_data.py", line 71, in <lambda>
    tupleize = lambda x: (x[1], float(x[0]))
ValueError: could not convert string to float: 'j��\x16��L'

Looks like there's some garbage in the database somehow.

ampedandwired commented 7 years ago

I found a database backup in ~/.local/share/autojump/autojump.txt.bak. Restoring this resolved the problem for me. So seems that somehow corrupted data is getting into the autojump DB which causes the exception.

pabloab commented 6 years ago

In my case autojump.txt became completely binary/"garbage" after autojump crash (don't know why). strings autojump.txt doesn't give anything useful. Fixed overwriting with autojump.txt.bak. Compared side by side with an hex editor and at least at first look I could't find any pattern. Using v22.2.4, Python 2.7.12.

jab commented 6 years ago

Just hit this on macOS running with a fresh homebrew --HEAD install. Removing ~/Library/autojump/autojump.txt{,.bak} did the trick.

pabloab commented 5 years ago

I cross again with this bug, this time with v22.2.4 Python 3.6.7. In this case I'm pretty sure the problem was moving around files with Cyrillic characters. The error was ValueError: could not convert string to float: '��m�\x18U(�϶'

BTW if you cat those files you might need to fix the messed terminal with reset.