I upgraded yesterday to piwik 2.04b7 and since I got an error running import_logs.py .
I run exactly the same script every night and since yesterday ( date of my last umdate) I got that error :
/usr/bin/python /var/www/html/piwik/misc/log-analytics/import_logs.py --url=https://w3stat.unil.ch/piwik/ --idsite=562 --config=/var/www/html/piwik/config/config.ini.php --recorders=2 --log-hostname=www2.unil.ch --hostname=www2.unil.ch --enable-static --enable-bots --enable-http-errors --enable-http-redirects --enable-reverse-dns --strip-query-string /var/tmp/stats/prod/access_full 2>&1
Traceback (most recent call last):
File “/var/www/html/piwik/misc/log-analytics/import_logs.py”, line 1707, in
config = Configuration()
File “/var/www/html/piwik/misc/log-analytics/import_logs.py”, line 567, in init
self._parse_args(self._create_parser())
File “/var/www/html/piwik/misc/log-analytics/import_logs.py”, line 557, in _parse_args
self.options.piwik_token_auth = self._get_token_auth()
File “/var/www/html/piwik/misc/log-analytics/import_logs.py”, line 604, in _get_token_auth
filename = subprocess.check_output(process, shell=True);
AttributeError: ‘module’ object has no attribute ‘check_output’
Any idea ?
Is there a safe way to downgrade piwik and go back to the latest stable version: 2.03
I cannot reproduce. Myabe it’s because of the particular log file? could you send a short log file which lets you reproduce the issue? or is it the same bug with all log files?
I upgrade to 2.04b11 and again the same error in importlogs.py. What did change between 2.04b6 and b7 ?? On my side I have exactly the same script running…
same bug with all logfiles … means logfile iindependent…
I do not understand . Would it be a python problem on my installation. I run python 2.6.6 But why would it be related to the upgrade form 2.4b6 to 2.04b7 ???
I tried to remove several options in particular the --config one but I always get the same problem… I also try on several log file and in particular the famous logfile ( inattchment) I used for test with 13 entries for the other counting pageviews problem I reported on a different topic and always I get this error …
Does the error message mean something for you ? I am not an expert in python programming…
I copy here again my command ( same options as you ) and the results I got . I repeat everything was fine with 2.0.4b6. The problem just occur after 2.04b7 upgrade …I also put in attachment the config.ini.php fiel I sue in order for you to check the plugins I use…
[cmoullet@prdwstat log-analytics]$ ./import_logs.py --url=https://w3stat.unil.ch/piwik/ --idsite=574 --recorders=2 --log-hostname=www3.unil.ch --hostname=www3.unil.ch --enable-static --enable-bots --enable-http-errors --enable-http-redirects --enable-reverse-dns --strip-query-string /var/tmp/stats/test/access_test
Traceback (most recent call last):
File “./import_logs.py”, line 1710, in
config = Configuration()
File “./import_logs.py”, line 567, in init
self._parse_args(self._create_parser())
File “./import_logs.py”, line 557, in _parse_args
self.options.piwik_token_auth = self._get_token_auth()
File “./import_logs.py”, line 604, in _get_token_auth
filename = subprocess.check_output(process, shell=True);
AttributeError: ‘module’ object has no attribute ‘check_output’
Please tell me if I can do something more on my side. I would really like to be able to run this import_logs script in order also to check if the pageview count is correct now…
It sounds like a bug we should fix. Please create a ticket at dev.piwik.org for this particular error (put full trace + command used + log file used + link to this ticket)
assign to 2.1 roadmap with Critical priority
we will then investigate
hi i remeber several others had issues when using lower than python 2.7.1 perhaps an upgrade to python alone may help things? certainly an eaiy way to check…
Hi, this is because there is a python 2.7 subprocess call in the script (subprocess.check_output). This should be replaced with a 2.6 friendly call like Popen. As a quick hack, change line 607 (in 2.1-rc1) to:
filename = subprocess.Popen(process, shell=True, stdout=subprocess.PIPE).communicate()[0]
Also it might be an idea to pass the arguments as a list and not use shell=True, which is a potential security issue.
Hope this helps
I’m now getting an auth error, but this is the first time i’ve used piwik so it’s probably something stupid i’m doing (i’ve tried passing both token-auth and login/password:
Traceback (most recent call last):
File “./import_logs.py”, line 1715, in
resolver = config.get_resolver()
File “./import_logs.py”, line 616, in get_resolver
return StaticResolver(self.options.site_id)
File “./import_logs.py”, line 961, in init
’SitesManager.getSiteFromId’, idSite=self.site_id
File “./import_logs.py”, line 943, in call_api
return cls._call_wrapper(cls._call_api, None, None, method, **kwargs)
File “./import_logs.py”, line 932, in _call_wrapper
raise Piwik.Error(message) main.Error: Authorization Required
… really stupid on my part, my piwik install was behind an http auth. removed it and everything working perfectly now. great product, really liking it so far
This will then exclude all RHEL and derivative OSs (CentOS etc), which are quite popular! It does seem to work perfectly in 2.6 with that one line change. Here’s a udiff that also changes the subprocess to a ‘native’ call rather than using a shell call:
OK finally with python 2.7 and piwik 2.1 rc1 I could finally make import_logs.py work !! Ouf !!
Now let-s check if I have the correct count (other ticket)