insanum / gcalcli

Google Calendar Command Line Interface
MIT License
3.27k stars 307 forks source link

pip3 install on Ubuntu 20.04 breaks #545

Open isene opened 4 years ago

isene commented 4 years ago

Did pip3 install gcalcli

Runs this:

urxvt -fn "-*-terminus-medium-*-*-*-16-*-*-*-*-*-*-*" -e sh -c "/usr/local/bin/gcalcli --calendar geir@a-circle.no\#yellow --calendar geir@isene.com\#white --lineart unicode calw now 13 --monday --military --width 33 --color-date white | less -R"

Gets this:

Traceback (most recent call last):
  File "/usr/local/bin/gcalcli", line 11, in <module>
    load_entry_point('gcalcli==4.3.0', 'console_scripts', 'gcalcli')()
  File "/usr/local/lib/python3.8/dist-packages/gcalcli-4.3.0-py3.8.egg/gcalcli/cli.py", line 167, in main
  File "/usr/local/lib/python3.8/dist-packages/gcalcli-4.3.0-py3.8.egg/gcalcli/gcal.py", line 1282, in CalQuery
  File "/usr/local/lib/python3.8/dist-packages/gcalcli-4.3.0-py3.8.egg/gcalcli/gcal.py", line 487, in _GraphEvents
TypeError: can't concat str to bytes
jcrowgey commented 4 years ago

Seems like you've found a bug, but I'm not able to repro this on my debian system. I'm using python 3.8.3 and I installed urxvt in order to try out your command exactly. I obviously had to use different calendars, though. In any case, this works as expected for me, no crash.

Are you able to create a simpler repro case? You're running a specific terminal with a specific font, a specifc shell in that terminal, gcalcli with a whole bunch of specific options, and then piping the output to a pager. Maybe you could boil this down a bit?

For example, I suppose that you'll have the same issue with this command:

/usr/local/bin/gcalcli --calendar geir@a-circle.no\#yellow --calendar geir@isene.com\#white --lineart unicode calw now 13 --monday --military --width 33 --color-date white

In order to work on this, the first step for me is to repro the situation.

sheiksadique commented 4 years ago

I also get the same error, even while running

/usr/local/bin/gcalcli --calendar geir@a-circle.no\#yellow --calendar geir@isene.com\#white --lineart unicode calw now 13 --monday --military --width 33 --color-date white

OS: Manjaro Terminal emulator: xfce4-terminal Python: 3.8.3 gcalcli: 4.3.0

michaelmhoffman commented 3 years ago
  1. I recommend always using python3.8 -m pip and never simply pip3. In the past I have had a lot of problems with the command-line pip tools not connecting to the Python distribution I thought they were.

  2. Debian does not play super-well with pip, in my experience. After struggling for a while trying to get a good setup for installing system packages with pip on Ubuntu, I now recommend using virtual environments to install anything you need from pip. For example on my Ubuntu 20.04 system I have the python3-pip and python3-venv Debian packages installed and then can use:

activate_bin="$HOME/venv/python3/bin/activate"

if [ ! -f "$activate_bin" ]; then
    python3 -m venv --system-site-packages ~/venv/python3
fi

. "$activate_bin"

After the activation script is run, any uses of pip within that shell installs stuff in ~/venv/python3 instead of /usr/local/bin.