Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
Fix LogFile class by using io.FileIO instead of file
Browse files Browse the repository at this point in the history
Thanks to Frank Hofmann for the right pointer to
https://stackoverflow.com/questions/47838405/porting-a-sub-class-of-python2-file-class-to-python3

Now at least "/usr/sbin/wicd -c -f -e -o" keeps running.

Still throws errors and warnings, though:

/usr/share/wicd/daemon/wicd-daemon.py:1925: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
  mainloop = gobject.MainLoop()
/usr/share/wicd/daemon/monitor.py:392: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
  mainloop = gobject.MainLoop()
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 1020, in _async_scan
    self._sync_scan()
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 1024, in _sync_scan
    scan = self.wifi.Scan(str(self.hidden_essid))
  File "/usr/lib/python3/dist-packages/wicd/networking.py", line 673, in Scan
    aps = wiface.GetNetworks(essid)
  File "/usr/lib/python3/dist-packages/wicd/wnettools.py", line 227, in newfunc
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/wicd/wnettools.py", line 1392, in GetNetworks
    entry = self._ParseAccessPoint(cell, ralink_info)
  File "/usr/lib/python3/dist-packages/wicd/wnettools.py", line 1447, in _ParseAccessPoint
    ap['bitrates'] = sorted(m, lambda x, y: int(float(x) - float(y)))
TypeError: sorted expected 1 arguments, got 2
  • Loading branch information
xtaran committed Sep 10, 2019
1 parent 187f85f commit fef2a43
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wicd/logfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@
import sys
import os
import time
import io

class SizeError(IOError):
""" Custom error class. """
pass

class LogFile:
class LogFile(io.FileIO):
"""LogFile(name, [mode="w"], [maxsize=360000])
Opens a new file object. After writing <maxsize> bytes a SizeError
will be raised.
"""
def __init__(self, name, mode="a", maxsize=360000):
super(LogFile, self).__init__(name, mode)
def __init__(self, name, mode="a", maxsize=360000, *args, **kwargs):
super(LogFile, self).__init__(name, mode, maxsize, *args, **kwargs)
self.maxsize = maxsize
self.eol = True
try:
Expand Down

0 comments on commit fef2a43

Please sign in to comment.