ghostbsd / networkmgr

NetworkMgr is a Python GTK3 network manager for FreeBSD, GhostBSD, TrueOS and DragonFlyBSD
BSD 3-Clause "New" or "Revised" License
95 stars 30 forks source link

IndexError: list index out of range #14

Closed jjess closed 6 years ago

jjess commented 6 years ago

After remove package networkmkgr-2.4 and /usr/local/lib/python2.7/networkmgr-1.10-py2.7.egg, followed by a new fressh install from github (sudo python3.6 setup.py install), I get the following error after start networkmgr from a terminal:

Traceback (most recent call last): File "/usr/local/share/networkmgr/trayicon.py", line 294, in update_everything self.check() File "/usr/local/share/networkmgr/trayicon.py", line 310, in check state = netstate() File "/usr/local/share/networkmgr/net_api.py", line 228, in netstate scn = scanSsid(ssid) TypeError: scanSsid() missing 1 required positional argument: 'wificard' Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/local/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/local/share/networkmgr/trayicon.py", line 302, in checkloop self.checkfornewcard() File "/usr/local/share/networkmgr/trayicon.py", line 306, in checkfornewcard if isanewnetworkcardinstall() is True: File "/usr/local/share/networkmgr/net_api.py", line 116, in isanewnetworkcardinstall if ifwificardadded() is True or ifwiredcardadded() is True: File "/usr/local/share/networkmgr/net_api.py", line 86, in ifwificardadded ifwifi = wifiscards[0].rstrip() IndexError: list index out of range

No icon is shown, but it seems there is an instance in panel because when I do right mouse click when I think networkmgr icon should be I can read in the terminal:

Traceback (most recent call last): File "/usr/local/share/networkmgr/trayicon.py", line 78, in icon_clicked self.thr.start() File "/usr/local/lib/python3.6/threading.py", line 842, in start raise RuntimeError("threads can only be started once") RuntimeError: threads can only be started once

I must say my laptop is running GhostBSD (originally 10.3) but updated to 10.4 via freebsd-update.

ericbsd commented 6 years ago

Thanks for reporting this I have miss that one, I will commit the fox right away.

ericbsd commented 6 years ago

https://github.com/GhostBSD/networkmgr/commit/7110738e165e6d98f9231f40ce386f8f6fd52fc0 should fix the issue and many more. Let me know if you have more problem.

jjess commented 6 years ago

I can't manage to get it working. After install new code I get this in the terminal:

Traceback (most recent call last): File "/usr/local/share/networkmgr/trayicon.py", line 296, in update_everything self.check(defaultdev) File "/usr/local/share/networkmgr/trayicon.py", line 313, in check state = netstate(defaultdev) File "/usr/local/share/networkmgr/net_api.py", line 232, in netstate sig = int(sn.partition(':')[0]) ValueError: invalid literal for int() with base 10: 'RATE' Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/local/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/local/share/networkmgr/trayicon.py", line 305, in checkloop self.checkfornewcard() File "/usr/local/share/networkmgr/trayicon.py", line 309, in checkfornewcard if isanewnetworkcardinstall() is True: File "/usr/local/share/networkmgr/net_api.py", line 121, in isanewnetworkcardinstall if ifwificardadded() is True or ifwiredcardadded() is True: File "/usr/local/share/networkmgr/net_api.py", line 91, in ifwificardadded ifwifi = wifiscards[0].rstrip() IndexError: list index out of range

In KDE no icon is shown. In XFCE the icon appears sometimes. It seems the wifi card is continuously attaching/detaching from wifi network (ifconfig shows "attached" and "no carrier" every few seconds). If I do right mouse button in the xfce icon or where I guess is placed in KDE I get this response in terminal:

Traceback (most recent call last): File "/usr/local/share/networkmgr/trayicon.py", line 78, in icon_clicked self.thr.start() File "/usr/local/lib/python3.6/threading.py", line 842, in start raise RuntimeError("threads can only be started once") RuntimeError: threads can only be started once

Sometimes I can see a menu with status, and options when do left mouse button click over icon (but the menu window appears displaced, not just below the panel (my panel is in the upper side). And sometimes I can't interact with networkmgr with left or right mouse button.

Despite of this weird behaviour, thanks for your effort Eric trying to improve networkmgr. As I said in first post, my laptop doesn't run pure GhostBSD 10.3 or 11.1. It's a 10.3 upgraded to 10.4 via freebsd-update (I don't know if this is relevant).

BR,

Jes

ericbsd commented 6 years ago

Everything is relevant the thing is I am doing a major change to it.

ericbsd commented 6 years ago

Hi Jes,

The latest commit to master should be fine and anytime you want to try feel free and that would be appreciated.

jjess commented 6 years ago

Hi Eric:

It seems that more or less same errors are still present. After launch networkmgr in a terminal I can see:

[jjess@bsd420s ~]$ networkmgr Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/local/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/local/share/networkmgr/trayicon.py", line 307, in updatetrayloop self.checkfornewcard() File "/usr/local/share/networkmgr/trayicon.py", line 323, in checkfornewcard if isanewnetworkcardinstall() is True: File "/usr/local/share/networkmgr/net_api.py", line 120, in isanewnetworkcardinstall if ifwificardadded() is True or ifwiredcardadded() is True: File "/usr/local/share/networkmgr/net_api.py", line 90, in ifwificardadded ifwifi = wifiscards[0].rstrip() IndexError: list index out of range

In KDE4 I'm unable to see the icon in panel, but when I do right mouse click in tray I can see in the terminal:

Traceback (most recent call last): File "/usr/local/share/networkmgr/trayicon.py", line 77, in icon_clicked self.thr.start() File "/usr/local/lib/python3.6/threading.py", line 842, in start raise RuntimeError("threads can only be started once") RuntimeError: threads can only be started once

I'll try it in XFCE too

jjess commented 6 years ago

In XFCE networkmgr autostarts but no icon is visible in panel and it seems it's not available in tray. If I kill its instance and start another one from terminal then I can see:

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/local/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/local/share/networkmgr/trayicon.py", line 307, in updatetrayloop self.checkfornewcard() File "/usr/local/share/networkmgr/trayicon.py", line 323, in checkfornewcard if isanewnetworkcardinstall() is True: File "/usr/local/share/networkmgr/net_api.py", line 120, in isanewnetworkcardinstall if ifwificardadded() is True or ifwiredcardadded() is True: File "/usr/local/share/networkmgr/net_api.py", line 90, in ifwificardadded ifwifi = wifiscards[0].rstrip() IndexError: list index out of range But no instance appears in tray (in KDE there is a empty space where the instance without icons is located).

There are a lot of error related to gtk theme, for example:

`(process:57150): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale.

(networkmgr:57150): Gtk-WARNING **: Theme parsing error: gtk.css:6:0: Expected semicolon

(networkmgr:57150): Gtk-WARNING **: Theme parsing error: gtk.css:7:0: Expected semicolon

(networkmgr:57150): Gtk-WARNING **: Theme parsing error: gtk.css:47:0: Expected semicolon

(networkmgr:57150): Gtk-WARNING **: Theme parsing error: gtk.css:197:0: Expected semicolon

(networkmgr:57150): Gtk-WARNING **: Theme parsing error: gtk.css:314:21: Invalid name of pseudo-class

(networkmgr:57150): Gtk-WARNING **: Theme parsing error: gtk.css:4099:0: Junk at end of value for border-style `

Very strange behaviour.

ericbsd commented 6 years ago

Thanks for that I will fix that as I ASAP.

ericbsd commented 6 years ago

I notice that I did not fix the initial problem that you reported on this issue and now https://github.com/GhostBSD/networkmgr/commit/19ec9922a766487dfd20f0f6f538ca4af8e9a18e should fix that. The Gtk-WARNING of the theme is because the theme is out of date with GTK version, not a big issue.

jjess commented 6 years ago

Perfect, problem fixed. It seems it's working well. Thanks Eric.

Only 2 things:

1) there's no visible icon in KDE panel (I'll try in XFCE, but it seems it's the same behaviour as before). I have to guess where in the tray it could be. 2) the menu appers displaced instead of directly below the panel or so... minor bug , it doesn't matter much. Attached image in this post.

Thanks again

networkmgr

jjess commented 6 years ago

Ops, another issue I reported before. Too many events logged in /var/log/auth.log:

`Dec 4 21:54:59 bsd420s doas: jjess ran command ifconfig em0 as root from /usr/home/jjess Dec 4 21:55:00 bsd420s doas: jjess ran command ifconfig iwn0 as root from /usr/home/jjess Dec 4 21:55:00 bsd420s doas: jjess ran command ifconfig iwn0 as root from /usr/home/jjess Dec 4 21:56:06 bsd420s doas: jjess ran command ifconfig em0 as root from /usr/home/jjess Dec 4 21:56:06 bsd420s doas: jjess ran command ifconfig em0 as root from /usr/home/jjess Dec 4 21:56:06 bsd420s doas: jjess ran command ifconfig iwn0 as root from /usr/home/jjess Dec 4 21:56:06 bsd420s doas: jjess ran command ifconfig iwn0 as root from /usr/home/jjess Dec 4 21:57:12 bsd420s doas: jjess ran command ifconfig em0 as root from /usr/home/jjess Dec 4 21:57:12 bsd420s doas: jjess ran command ifconfig em0 as root from /usr/home/jjess Dec 4 21:57:12 bsd420s doas: jjess ran command ifconfig iwn0 as root from /usr/home/jjess

Dec 4 21:57:12 bsd420s doas: jjess ran command ifconfig iwn0 as root from /usr/home/jjess `

Not good behaviour for a SSD disk.

ericbsd commented 6 years ago

NetworkMgr is GTK I am not aware how GTK3 Menu behave in KDE or any QT DE. Not sure but if the icon does not work it is probably because icon-cache of hicolor is not updated. sudo gtk-update-icon-cache -f /usr/local/share/icons/hicolor

ericbsd commented 6 years ago

For the auth.log I will probably have to find a better way than doas to gain root access to get some info.

ericbsd commented 6 years ago

Looking at everything I have added doas at some place that does not need it.

ericbsd commented 6 years ago

https://github.com/GhostBSD/networkmgr/commit/fdf95bfe06a6859a66aadb237df4a64ff8e80362 should fix the log problem I did put doas in some places that do not need it at all. So right now only the normal use of doas will be logged like disconnecting, connecting.