Deleting old Python version

Or when you got the permission errors trying to make version 3 default, try running the command with sudo perhaps?

My system was showing version 2.7 as default also. running the commands to change the default as listed in the link above but with sudo worked and now version 3.7 is reported as default. I’m assuming that most installs (at least updated to matrix) will be default version 2.7 and it probably makes no difference to most things.
But hopefully either importing the tree to version 2.7 or setting default to 3.7 will help

And instead of running python -v to get the version try python --version

Hi,

After running the plugin, can you please run:

grab-logs -A

Please provide the given link.

Thanks Tom.

Wait, are you trying to run a Python script from some other program besides Kodi? That hasn’t been at all clear. Python in Kodi and Python in the operating system are two completely separate things. And there is something called zap2epg that exists as a Kodi add-on.

If you’re trying to get TVHeadEnd to run a Python script, you need to call it using:

python3 <scriptpath>

I don’t use TVHeadEnd at all, so I can’t help more there. But it sure would help everyone else if you were clear about what you’re trying to do. You should not have to delete Python 2.x to be able to run things in Python 3.x.

@modul8
I went into Python2.7 and imported the tree using import xml.etree.ElementTree as ET and it appeared to accept it. Leaving Python and typing python --version gives me

Python 2.7.16

As for the permissions and using sudo, I don’t know how to do that. But, honestly, zap2epg worked fine in the past and even the author of it has told me that using Python2.7 shouldn’t make a difference.

@Tom_Doyle
As mentioned above, I went into the web UI of TVH and ran the EPG Grabber Modules (zap2epg is the only one that is enabled) and the TVH log spat out this:

2021-08-21 12:04:00.000 xmltv: /usr/bin/tv_grab_zap2epg: grab /usr/bin/tv_grab_zap2epg
2021-08-21 12:04:00.005 spawn: Executing “/usr/bin/tv_grab_zap2epg”
2021-08-21 12:04:00.367 spawn: Traceback (most recent call last):
2021-08-21 12:04:00.367 spawn: File “/home/osmc/.kodi/addons/script.module.zap2epg/zap2epg.py”, line 814, in
2021-08-21 12:04:00.367 spawn: mainRun(userdata)
2021-08-21 12:04:00.367 spawn: File “/home/osmc/.kodi/addons/script.module.zap2epg/zap2epg.py”, line 38, in mainRun
2021-08-21 12:04:00.367 spawn: settings = ET.parse(settingsFile)
2021-08-21 12:04:00.368 spawn: File “/usr/lib/python2.7/xml/etree/ElementTree.py”, line 1182, in parse
2021-08-21 12:04:00.368 spawn: tree.parse(source, parser)
2021-08-21 12:04:00.368 spawn: File “/usr/lib/python2.7/xml/etree/ElementTree.py”, line 647, in parse
2021-08-21 12:04:00.369 spawn: source = open(source, “rb”)
2021-08-21 12:04:00.369 spawn: IOError: [Errno 2] No such file or directory: ‘/home/osmc/.kodi/userdata/addon_data/script.module.zap2epg/settings.xml’
2021-08-21 12:04:00.395 spawn: cat: /home/osmc/.kodi/userdata/addon_data/script.module.zap2epg/xmltv.xml: No such file or directory
2021-08-21 12:04:00.396 xmltv: /usr/bin/tv_grab_zap2epg: no output detected
2021-08-21 12:04:00.397 xmltv: /usr/bin/tv_grab_zap2epg: grab returned no data
2021-08-21 12:05:25.187 xmltv: /usr/bin/tv_grab_zap2epg: grab /usr/bin/tv_grab_zap2epg
2021-08-21 12:05:25.191 spawn: Executing “/usr/bin/tv_grab_zap2epg”
2021-08-21 12:05:25.543 spawn: Traceback (most recent call last):
2021-08-21 12:05:25.543 spawn: File “/home/osmc/.kodi/addons/script.module.zap2epg/zap2epg.py”, line 814, in
2021-08-21 12:05:25.543 spawn: mainRun(userdata)
2021-08-21 12:05:25.543 spawn: File “/home/osmc/.kodi/addons/script.module.zap2epg/zap2epg.py”, line 38, in mainRun
2021-08-21 12:05:25.543 spawn: settings = ET.parse(settingsFile)
2021-08-21 12:05:25.543 spawn: File “/usr/lib/python2.7/xml/etree/ElementTree.py”, line 1182, in parse
2021-08-21 12:05:25.544 spawn: tree.parse(source, parser)
2021-08-21 12:05:25.544 spawn: File “/usr/lib/python2.7/xml/etree/ElementTree.py”, line 647, in parse
2021-08-21 12:05:25.544 spawn: source = open(source, “rb”)
2021-08-21 12:05:25.545 spawn: IOError: [Errno 2] No such file or directory: ‘/home/osmc/.kodi/userdata/addon_data/script.module.zap2epg/settings.xml’
2021-08-21 12:05:25.571 spawn: cat: /home/osmc/.kodi/userdata/addon_data/script.module.zap2epg/xmltv.xml: No such file or directory
2021-08-21 12:05:25.572 xmltv: /usr/bin/tv_grab_zap2epg: no output detected
2021-08-21 12:05:25.572 xmltv: /usr/bin/tv_grab_zap2epg: grab returned no data

If the above is not enough info, I also went back to the command line in Putty and ran grab-logs -A and the logs are here.

@pkscout I’m not sure about the terminology and perhaps I’ve better described what I am trying to do in other forum posts. This has been an ongoing problem for some time now. It boils down to this:
I use TVH to watch over the air (antenna) TV. zap2epg is a script (“script” might be the wrong term) that grabs EPG info from the internet and passes it on to TVH. I do not believe zap2epg exists in the official Kodi repository, so I have downloaded it from the author at github, but it keeps giving errors (see my above reply to @Tom_Doyle) and essentially doesn’t work, even though it did for, frankly, years.

Hi,

Is this the addon?

If that’s the case, you need to be using python3. I suggest asking the developer to add the following to the top of zap2epg.py:

#!/usr/bin/env python3

Thanks Tom.

If for some reason Tom’s suggestion doesn’t work, I looked at the bash script at:

script.module.zap2epg/bin/tv_grab_zap2epg

That’s the script that I’m guessing TVHeadEnd calls, which in turn calls a python script. On line 28 it calls that python script using:

python $ADDON_DIR/zap2epg.py

Change that to:

python3 $ADDON_DIR/zap2epg.py
1 Like

adding that “3” to line 28 made my EPG fill up with glorious information!

Thank you so much for your and everyone’s help!