edc / bass

Make Bash utilities usable in Fish shell
MIT License
2.2k stars 70 forks source link

error: dictionary update sequence element #27 has length 1; 2 is required #15

Closed janraasch closed 8 years ago

janraasch commented 8 years ago

Hi there,

this may be a super newbie problem, but I am not afraid to ask :).

Everytime I run bass I get the error

dictionary update sequence element #27 has length 1; 2 is required

even for very simple this, e.g.

bass export X=3
dictionary update sequence element #27 has length 1; 2 is required
Bass encountered an error!

I am running bass on Mac OS 10.11 El Capitan. fish is installed via brew.

brew info fish yields

brew info fish
fish: stable 2.2.0 (bottled), HEAD
User-friendly command-line shell for UNIX-like operating systems
http://fishshell.com
/usr/local/Cellar/fish/2.1.1 (677 files, 5.4M)
  Poured from bottle
/usr/local/Cellar/fish/2.2.0 (726 files, 6.7M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/fish.rb
==> Caveats
You will need to add:
  /usr/local/bin/fish
to /etc/shells. Run:
  chsh -s /usr/local/bin/fish
to make fish your default shell.

If you are upgrading from an older version of fish, you should now run:
  killall fishd
to terminate the outdated fish daemon.

and

python --version
Python 2.7.10

Adding traceback in the error handler

except Exception as e:
    print('-')
    traceback.print_exc(file=sys.stdout)
    print('-')

yields some more information:

Traceback (most recent call last):
  File "/Users/Default/.config/fish/functions/__bass.py", line 76, in <module>
    name = gen_script()
  File "/Users/Default/.config/fish/functions/__bass.py", line 42, in gen_script
    old_env = dict([line.split('=', 1) for line in old_env])
ValueError: dictionary update sequence element #27 has length 1; 2 is required

when running e.g. python ~/.config/fish/functions/__bass.py ls

Can you help me out?

janraasch commented 8 years ago

Ok. I found it. This is gonna be funny. I had

set -g -x fish_greeting '              |\    \ \ \ \ \ \ \      __           ___
              |  \    \ \ \ \ \ \ \   | O~-_    _-~~  ~~-_
              |   >----|-|-|-|-|-|-|--|  __/   /  BYTE     )
              |  /    / / / / / / /   |__\   <             )
              |/     / / / / / / /             \_   ME !  _)
                                                 ~--___--~
»OMG. It\'s fish dogg!!!«

Welcome to fish, the friendly interactive shell.'

at the beginning of my ~/.config/fish/config.fish file.

Apparently this was causing trouble when parsing the old_env. Is there a way to work around this? I would love to see that dear fish dogg again.

edc commented 8 years ago

Thanks for reporting it. I created a PR to fix it. If you cannot wait for it to merge, you can grab the updated __bass.py file. Let me know how it goes.

janraasch commented 8 years ago

@edc great. Thanks a lot.

edc commented 8 years ago

@janraasch The PR has been merged. Let me know if you still have the same issue.

janraasch commented 8 years ago

Works like a charm. Thank you, @edc.