Error Running Script 'import_logs.py'


#1

I upgraded from 1.71 to 1.7.2rc8 today. Located the ‘log-analytics’ folder, ran the script like this:

python import_logs.py --idsite=5

To which I got the following response:
File “import_logs.py”, line 303
Level=logging.DEBUG if self.options.debug >=1 else logging.INFO,
Syntax Error: invalid syntax

I tried it without the --idsite=5, same result.

What am I doing wrong?

According to what I read, this should display (at minimum) a help screen.


(Matthieu Aubry) #2

it works for me. can you please try latest python script from: http://dev.piwik.org/svn/trunk/misc/log-analytics/import_logs.py


#3

I went to the link you provided, got the latest script, uploaded it to the correct location, but when I run it I continue to get the same error as I listed in my original post.

Any help would be greatly appreciated.


(Matthieu Aubry) #4

try with latest Python 2.x ?


#5

I am having the same problem. My server is running Python 2.7.


#6

I am having same error with piwik 1.8 version, could you please fix it? I am using following version of python.

[root@localhost log-analytics]# python -V
Python 2.4.3

@matt - what python version are you using?


(Matthieu Aubry) #7

Plese post all errors in this ticket where the Python developer will listen :slight_smile: Log analytics list of improvements · Issue #3163 · matomo-org/matomo · GitHub


(Thomas Seifert) #8

Hmm, works fine here with
python --version
Python 2.7.3


#9

The ternary operator “if” was introduced with python 2.5, so that code simply won’t compile with older python versions.


(Matthieu Aubry) #10

If you manage to create a patch to have support for your Piwik version, we will gladly commit it to SVN :slight_smile:

Thanks!


#11

Out of unforeseen necessity, I had to move my major Piwik installation to a different server while some major repairs were going on with the other one.

However, I’m still importing 25Gb worth of logs, 250k lines at a time :slight_smile:

Problem is, I’m running Piwik 1.9, and this alternate server is using python 2.4.3 (previous server using 2.6.6), and now trying to import logs is giving me this error:


File "misc/log-analytics/import_logs.py", line 375
    level=logging.DEBUG if self.options.debug >= 1 else logging.INFO,
                         ^
SyntaxError: invalid syntax

is there a patch I should try, or should I just wait a couple days and go back to the replacement server that’s coming?


(Matthieu Aubry) #12

Script isnt compat with older python versions at this stage, sorry


#13

For users on GoDaddy shared hosting, the default available version of python is 2.4.3

However! If you are on a shared hosting linux account you can try to use the following to invoke Python 2.7:


/usr/local/bin/python2.7 misc/log-analytics/import_logs.py ...

SSH must be activated on your account. For more information, see: Can I use Python 2.7.2 with my hosting account?

Hope that helps! :wink:

Sven2157