[Ross Gammon]
> Hi Petter,
Hi. Glad to get such quick response. :)
> Unfortunately, when you install this version of creepy it does not work.
>
> If you install it, and then run the python script you get:
> ross@debian-sid-install:/usr/share/creepy$ python CreepyMain.py
> Traceback (most recent call last):
> File "CreepyMain.py", line 38, in <module>
> fh = logging.FileHandler(os.path.join(os.getcwd(),'creepy_main.log'))
> File "/usr/lib/python2.7/logging/__init__.py", line 911, in __init__
> StreamHandler.__init__(self, self._open())
> File "/usr/lib/python2.7/logging/__init__.py", line 936, in _open
> stream = open(self.baseFilename, self.mode)
> IOError: [Errno 13] Permission denied: '/usr/share/creepy/creepy_main.log'
That is nasty. If it want to write a log, it should write it into
$HOME/.creepy/main.log or something like that when running as a
non-privileged user, and into /var/log/creepy/main.log (or even
better, use syslog) if running as a provileged user (which I guess do
not apply here).
> The program runs fine from within the source directory. I have not
> tried to patch creepy to write the log to a better place to see if
> it is the only problem, but I did contact upstream to tell him of
> the problem. He seemed to be willing to make try and use a build
> system and tweak the code so that creepy is more flexible about the
> installed location. I suggested distutils which would make for a
> simple d/rules file.
Aha.
> Checking upstream again, there does not seem to be many recent
> commits. There is a constant battle to keep up to date with all the
> API changes from the services that are used as plugins (instagram
> etc.). A 1.2 alpha version was uploaded, but the promised final
> release has not yet appeared.
>
> We could try patching CreepyMain.py?
Probably a good idea. Does this untested patch work for you?
--- a/creepy/CreepyMain.py
+++ b/creepy/CreepyMain.py
@@ -35,7 +35,12 @@ from utilities import GeneralUtilities
# set up logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
-fh = logging.FileHandler(os.path.join(os.getcwd(),'creepy_main.log'))
+userdir = os.path.expanduser('~/.creepy')
+try: os.makedirs(userdir)
+except OSError as e:
+ if e.errno == errno.EEXIST and os.path.isdir(userdir): pass
+ else: raise
+fh = logging.FileHandler(os.path.join(userdir,'main.log'))
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s -
%(message)s')
fh.setFormatter(formatter)
--
Happy hacking
Petter Reinholdtsen
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]