enkore / i3pystatus

A complete replacement for i3status
https://i3pystatus.readthedocs.io/
MIT License
445 stars 188 forks source link

Import Error 'Color' #708

Open eraserpencil opened 5 years ago

eraserpencil commented 5 years ago

I am trying out i3pystatus, but when configuring the status bar, I encounter the error "ImportError(cannot import name 'Color')

I am currently on Ubuntu 16.04, 4.15.0-43-generic. Python version 3.5.2, i3pystatus version 3.35.

My i3 config file:

 bar {
      mode hide
      status_command python3 /home/pbj/Documents/projects/i3/status.py
 }

My i3pystatus config file:

#!/usr/bin/env python3

from i3pystatus import Status

status = Status(
#    logformat=i'%(asctime)s %(levelname)s %(pathname)s %(module)s %(funcName)s %(lineno)d %(message)s:',
)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
format="%a %-d %b %X",

# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
format="{temp:.0f}°C",)
status.run()
terminalmage commented 5 years ago

If you add a logfile argument to your Status() line, you'll be able to get the full context of the traceback. For example:

status = Status('/home/myuser/i3pystatus.log')

Then if you start i3pystatus again, the full traceback should show up in that log.

chestm007 commented 5 years ago

This looks like a missing python library

please try the following and restart i3pystatus

sudo pip3 install color
terminalmage commented 5 years ago

Yeah, the temp module does import from i3pystatus.core.color which pulls that in. I just wanted to help him/her self-troubleshoot :smile:

eraserpencil commented 5 years ago

Whoops!

Forgot to mention i have Color v0.1 already installed, along with colorama and colour_science.

I tried the loggig way, but I dont see the logfile any where. even after i3-msg restart

chestm007 commented 5 years ago

so, my mistake. colour is actually spelt different

sudo pip3 install colour

notice the "u"

if that still fails please post the output of pip3 freeze

also regarding logging, im unsure if it is actually a problem but my status object is initialized like

status = Status(logfile='/home/max/.i3pystatus.log')
eraserpencil commented 5 years ago

actionlib==1.11.13 angles==1.9.11 apturl==0.5.2 beautifulsoup4==4.4.1 blinker==1.3 bondpy==1.8.3 Brlapi==0.6.4 camera-calibration==1.12.23 camera-calibration-parsers==1.11.13 capabilities==0.2.0 catkin==0.7.14 chardet==2.3.0 checkbox-support==0.22 color==0.1 colorama==0.4.1 colour==0.1.5 colour-science==0.3.11 command-not-found==0.3 controller-manager==0.13.3 controller-manager-msgs==0.13.3 cryptography==1.2.3 cv-bridge==1.12.8 defer==1.0.6 diagnostic-analysis==1.9.3 diagnostic-common-diagnostics==1.9.3 diagnostic-updater==1.9.3 dynamic-reconfigure==1.5.50 enum34==1.1.6 feedparser==5.1.3 gazebo-plugins==2.5.18 gazebo-ros==2.5.18 gencpp==0.6.0 geneus==2.2.6 genlisp==0.4.16 genmsg==0.5.11 gennodejs==2.0.1 genpy==0.6.7 guacamole==0.9.2 html5lib==0.999 httplib2==0.9.1 i3pystatus==3.35 idna==2.0 image-geometry==1.12.8 interactive-markers==1.11.4 Jinja2==2.8 language-selector==0.1 laser-geometry==1.6.4 louis==2.6.4 lxml==3.5.0 Mako==1.0.3 MarkupSafe==0.23 message-filters==1.12.14 netifaces==0.10.9 numpy==1.16.1 oauthlib==1.0.3 onboard==1.2.0 padme==1.1.1 pexpect==4.0.1 Pillow==3.1.2 plainbox==0.25 pluginlib==1.11.3 ptyprocess==0.5 py3status==3.16 pyasn1==0.1.9 pycups==1.9.73 pycurl==7.43.0 pygobject==3.20.0 PyJWT==1.3.0 pyparsing==2.0.3 python-apt==1.1.0b1+ubuntu0.16.4.2 python-debian==0.1.27 python-qt-binding==0.3.4 python-systemd==231 python-termstyle==0.1.10 pytz==2018.9 pywal==3.2.1 pyxdg==0.25 qt-dotgraph==0.3.11 qt-gui==0.3.11 qt-gui-cpp==0.3.11 qt-gui-py-common==0.3.11 reportlab==3.3.0 requests==2.9.1 resource-retriever==1.12.4 rosapi==0.10.1 rosbag==1.12.14 rosboost-cfg==1.14.4 rosbridge-library==0.10.1 rosbridge-server==0.10.1 rosclean==1.14.4 roscreate==1.14.4 rosgraph==1.12.14 rosjava-build-tools==0.3.3 roslaunch==1.12.14 roslib==1.14.4 roslint==0.11.0 roslz4==1.12.14 rosmake==1.14.4 rosmaster==1.12.14 rosmsg==1.12.14 rosnode==1.12.14 rosparam==1.12.14 rospy==1.12.14 rosservice==1.12.14 rostest==1.12.14 rostopic==1.12.14 rosunit==1.14.4 roswtf==1.12.14 rqt-action==0.4.9 rqt-bag==0.4.12 rqt-bag-plugins==0.4.12 rqt-console==0.4.8 rqt-dep==0.4.9 rqt-graph==0.4.9 rqt-gui==0.5.0 rqt-gui-py==0.5.0 rqt-image-view==0.4.13 rqt-launch==0.4.8 rqt-logger-level==0.4.8 rqt-moveit==0.5.7 rqt-msg==0.4.8 rqt-nav-view==0.5.7 rqt-plot==0.4.8 rqt-pose-view==0.5.8 rqt-publisher==0.4.8 rqt-py-common==0.5.0 rqt-py-console==0.4.8 rqt-reconfigure==0.4.10 rqt-robot-dashboard==0.5.7 rqt-robot-monitor==0.5.8 rqt-robot-steering==0.5.9 rqt-runtime-monitor==0.5.7 rqt-rviz==0.5.10 rqt-service-caller==0.4.8 rqt-shell==0.4.9 rqt-srv==0.4.8 rqt-tf-tree==0.5.8 rqt-top==0.4.8 rqt-topic==0.4.10 rqt-web==0.4.8 rviz==1.12.16 scipy==1.2.0 sensor-msgs==1.12.7 sessioninstaller==0.0.0 six==1.12.0 smach==2.0.1 smach-ros==2.0.1 smclib==1.8.3 ssh-import-id==5.5 system-service==0.3 tf==1.11.9 tf-conversions==1.11.9 tf2-geometry-msgs==0.5.20 tf2-kdl==0.5.20 tf2-py==0.5.20 tf2-ros==0.5.20 tf2-sensor-msgs==0.5.20 topic-tools==1.12.14 tzlocal==1.5.1 ubuntu-drivers-common==0.0.0 ufw==0.35 unattended-upgrades==0.1 unity-scope-calculator==0.1 unity-scope-chromiumbookmarks==0.1 unity-scope-colourlovers==0.1 unity-scope-devhelp==0.1 unity-scope-firefoxbookmarks==0.1 unity-scope-gdrive==0.7 unity-scope-manpages==0.1 unity-scope-openclipart==0.1 unity-scope-texdoc==0.1 unity-scope-tomboy==0.1 unity-scope-virtualbox==0.1 unity-scope-yelp==0.1 unity-scope-zotero==0.1 urllib3==1.13.1 usb-creator==0.3.0 xacro==1.11.3 xdiagnose==3.8.4.1 xkit==0.0.0 XlsxWriter==0.7.3 xtermcolor==1.2.1

Can't get the logging to work. Btw, I tried it with a comma

status = Status(logfile='/home/max/.i3pystatus.log')
and
status = Status(logfile='/home/max/.i3pystatus.log',)
chestm007 commented 5 years ago

interesting... whats the output of:

python3 /home/pbj/Documents/projects/i3/status.py

chestm007 commented 5 years ago

also, try changing

#!/usr/bin/env python3

in /home/pbj/Documents/projects/i3/status.py to:

#!/usr/bin/python
lasers commented 5 years ago

I got ImportError(cannot import name 'Color') too. Pip installing colour works okay.

also regarding logging, im unsure if it is actually a problem...

I got nothing with status = Status(logfile='$HOME/i3pystatus.log') too. We have a problem?

also, try changing ...env python3 to ... python.

This shouldn't work because python is still 2.7 on Ubuntu 16.04. [xenial/python]

chestm007 commented 5 years ago

I got ImportError(cannot import name 'Color') too. Pip installing colour works okay.

That makes sense, its the required package

This shouldn't work because python is still 2.7 on Ubuntu 16.04

thats an excellent point... i keep forgetting ubuntu are still in the dark ages

I got nothing with status = Status(logfile='$HOME/i3pystatus.log') too. We have a problem?

That appears to be an issue - although logging to a file works for me, i use absolute paths however

lasers commented 5 years ago

Logging works fine. I was expecting real-time logging. Sorry. :sob:

@eraserpencil See if your colour are installed via pip (Python2) or pip3. (Python3). We like pip3.

terminalmage commented 4 years ago

@lasers $HOME is a shell variable, Python won't expand it. You would need to do something like:

import os

status = Status(logfile=os.path.expanduser('~/i3pystatus.log'))

However, once you get logging enabled, you won't necessarily see logging output, unless the module developer is actively using logging, and the temp module doesn't actually do any logging. The log file will show exceptions, I think, but nothing else from the module.

This hasn't had any activity in almost 18 months. Are you still having trouble @eraserpencil @lasers?

lasers commented 4 years ago

@terminalmage I vaguely remember getting this to work with pip3. My logging statement is unrelated.