Closed flippz closed 2 years ago
make sure you've created the /var/lib/tvh_epg directory and set the permissions, then go to the settings page and tweak/save
drwxrwxrwx 2 www-data www-data 4096 May 15 20:35 tvh_epg
I did that. The page tvh_epg.py just gives an error: `Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log. ` Cant Even get to the settings page
søn. 15. mai 2022, 21:25 skrev Paul M @.***>:
make sure you've created the /var/lib/tvh_epg directory and set the permissions, then go to the settings page and tweak/save
— Reply to this email directly, view it on GitHub https://github.com/speculatrix/tvh_epg/issues/15#issuecomment-1127004230, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFCLC524NDFFRUXP7TUCHPDVKFFTBANCNFSM5V7OD66A . You are receiving this because you authored the thread.Message ID: @.***>
hmm. ok, try creating a /var/lib/tvh_epg/tvh_epg_settings.ini file with this in it:
[user] logodir = TVLogos ts_pass = blahblah ts_url = http://tvh.example.com:9981 sh_ch_logo = 1 ts_pauth = blahblahblah ts_user = webby ts_url_icons = https://tvh.example.com/TVLogos ts_url_icon_cast = https://tvh.example.com/ic_cast_connected_black_24dp.png max_chans = 1750 forced_icon_height = 64 forced_icon_width = 80 auth_plain_digest = digest profile_streaming = audio-only profile_chromecasting = chromecast profile_strm = default page_bg_col = a0a0a0 bg_col_input = f8f8f8 bg_col_page = f4f4f4 ts_auth_type = plain
don't worry about changing the content, use the settings editor later. save that file and change the owner/group to the web server user, e.g.
sudo chown www-data: /var/lib/tvh_epg/tvh_epg_settings.ini
sorry for the inconvenence. I guess the cgi might not work if there's no settings file at all, if the above fixes it, I will find and fix the bug.
It did not fix it. The apache webserver is running with serveral different user so my cgi-bin is inside the home/player folder. Im thinking thats the problem. I'll create a new apache webserver tomorrow and see if that fixes the problem. I'll get back to you
try changing the login shell for the www-data user account and then you can "su - www-data", and then try running the cgi-bin at the command line to see what error it prints out.
sometimes apache sends errors from cgi-bin to the /var/log/syslog (or /var/log/messages) file instead of /var/log/apache2/something
so it's worth looking in various places to work out what's going wrong
it gives this:
www-data@cloud:/home/player/cgi-bin$ python tvh_epg.py File "tvh_epg.py", line 579 '<img src="%s"' % (chan_img_url, ), end='') ^ SyntaxError: invalid syntax
ah, I think your python is python2. try editing the first line to explicitly be python3
The first line says:
ah, ok. let me check what I am running with what's committed to github.
thanks for your patience
when i do python i get Python 2.7.18 but when i do apt install python3 i get: python3 is already the newest version (3.8.2-0ubuntu2).
please can you do an md5sum to check, it should be 57cda1516b962e44c3d426fa4b1f65ab ?
please can you use the code block quote here and copy and paste lines 576 to 572 as a response?
I pulled a fresh copy down from github and it works for me. I'm on python 3.8.10 but I am not using any features that require the latest version.
else: chan_name_ref = chan_name chan_img_url = '%s/%s.png' % (icon_url, chan_name_ref, ) print('<td width="100px" align="right" class="chan_icon">' \ '<img src="%s"' % (chan_img_url, ), end='')
Not getting that md5sum though. I just copied and pasted the code from git
can you see the <> above the comment box?
wait, did you git clone and copy the tvh_epg.py file over?
or even do
wget https://raw.githubusercontent.com/speculatrix/tvh_epg/master/tvh_epg.py
to get the file?
if i do python3 tch_epg.py i get this: `www-data@cloud:/home/player/cgi-bin$ python3 tvh_epg.py Content-Type: text/html; charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
A problem occurred in a Python script. `
Downloaded tvh_epg.py now like u sayd and got the corrent md5sum but still same problem
ok, now you need to go to settings and change the tvh server host to your TVH server, you seem to be trying to connect to the example URL
well that was from the console, its not working in browser
Seems it needs python3 to work?
since it will execute from the command line, then you must have most of the system components installed to make it work, so you need to ensure your web server is set so that it will execute the script as a cgi-bin when you go to the right URL
also, did you enable the cgi modules in apache? you should see something like this:
$ls -la /etc/apache2/mods-enabled/
total 8
drwxr-xr-x 2 root root 4096 May 15 11:02 .
drwxr-xr-x 8 root root 4096 May 15 11:21 ..
lrwxrwxrwx 1 root root 36 Oct 9 2021 access_compat.load -> ../mods-available/access_compat.load
lrwxrwxrwx 1 root root 28 Oct 9 2021 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root 28 Oct 9 2021 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root 34 May 15 11:02 auth_digest.load -> ../mods-available/auth_digest.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 authn_core.load -> ../mods-available/authn_core.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 authz_core.load -> ../mods-available/authz_core.load
lrwxrwxrwx 1 root root 38 May 15 11:02 authz_groupfile.load -> ../mods-available/authz_groupfile.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root 32 Oct 9 2021 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root 32 Oct 9 2021 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root 27 Oct 9 2021 cgid.conf -> ../mods-available/cgid.conf
lrwxrwxrwx 1 root root 27 Oct 9 2021 cgid.load -> ../mods-available/cgid.load
lrwxrwxrwx 1 root root 30 Oct 9 2021 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root 30 Oct 9 2021 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root 26 Oct 9 2021 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root 26 Oct 9 2021 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root 26 Oct 9 2021 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root 29 Oct 9 2021 filter.load -> ../mods-available/filter.load
lrwxrwxrwx 1 root root 30 Oct 9 2021 headers.load -> ../mods-available/headers.load
lrwxrwxrwx 1 root root 27 Oct 9 2021 info.conf -> ../mods-available/info.conf
lrwxrwxrwx 1 root root 27 Oct 9 2021 info.load -> ../mods-available/info.load
lrwxrwxrwx 1 root root 27 Oct 9 2021 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root 27 Oct 9 2021 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root 32 Oct 9 2021 mpm_event.conf -> ../mods-available/mpm_event.conf
lrwxrwxrwx 1 root root 32 Oct 9 2021 mpm_event.load -> ../mods-available/mpm_event.load
lrwxrwxrwx 1 root root 34 Oct 9 2021 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root 34 Oct 9 2021 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root 33 Oct 9 2021 reqtimeout.conf -> ../mods-available/reqtimeout.conf
lrwxrwxrwx 1 root root 33 Oct 9 2021 reqtimeout.load -> ../mods-available/reqtimeout.load
lrwxrwxrwx 1 root root 31 Oct 9 2021 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root 31 Oct 9 2021 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root 36 Oct 9 2021 socache_shmcb.load -> ../mods-available/socache_shmcb.load
lrwxrwxrwx 1 root root 26 Oct 9 2021 ssl.conf -> ../mods-available/ssl.conf
lrwxrwxrwx 1 root root 26 Oct 9 2021 ssl.load -> ../mods-available/ssl.load
lrwxrwxrwx 1 root root 29 Oct 9 2021 status.conf -> ../mods-available/status.conf
lrwxrwxrwx 1 root root 29 Oct 9 2021 status.load -> ../mods-available/status.load
Yes
total 8 drwxr-xr-x 2 root root 4096 May 15 23:06 . drwxr-xr-x 9 root root 4096 May 15 10:55 .. lrwxrwxrwx 1 root root 36 Aug 29 2021 access_compat.load -> ../mods-available/access_compat.load lrwxrwxrwx 1 root root 40 Aug 29 2021 actions.conf -> /etc/apache2/mods-available/actions.conf lrwxrwxrwx 1 root root 40 Aug 29 2021 actions.load -> /etc/apache2/mods-available/actions.load lrwxrwxrwx 1 root root 28 Aug 29 2021 alias.conf -> ../mods-available/alias.conf lrwxrwxrwx 1 root root 28 Aug 29 2021 alias.load -> ../mods-available/alias.load lrwxrwxrwx 1 root root 33 Aug 29 2021 auth_basic.load -> ../mods-available/auth_basic.load lrwxrwxrwx 1 root root 44 Aug 29 2021 auth_digest.load -> /etc/apache2/mods-available/auth_digest.load lrwxrwxrwx 1 root root 33 Aug 29 2021 authn_core.load -> ../mods-available/authn_core.load lrwxrwxrwx 1 root root 33 Aug 29 2021 authn_file.load -> ../mods-available/authn_file.load lrwxrwxrwx 1 root root 33 Aug 29 2021 authz_core.load -> ../mods-available/authz_core.load lrwxrwxrwx 1 root root 33 Aug 29 2021 authz_host.load -> ../mods-available/authz_host.load lrwxrwxrwx 1 root root 33 Aug 29 2021 authz_user.load -> ../mods-available/authz_user.load lrwxrwxrwx 1 root root 32 Aug 29 2021 autoindex.conf -> ../mods-available/autoindex.conf lrwxrwxrwx 1 root root 32 Aug 29 2021 autoindex.load -> ../mods-available/autoindex.load lrwxrwxrwx 1 root root 27 May 15 19:40 cgid.conf -> ../mods-available/cgid.conf lrwxrwxrwx 1 root root 27 May 15 19:40 cgid.load -> ../mods-available/cgid.load lrwxrwxrwx 1 root root 36 Aug 29 2021 cgi.load -> /etc/apache2/mods-available/cgi.load lrwxrwxrwx 1 root root 39 Aug 29 2021 dav_fs.conf -> /etc/apache2/mods-available/dav_fs.conf lrwxrwxrwx 1 root root 39 Aug 29 2021 dav_fs.load -> /etc/apache2/mods-available/dav_fs.load lrwxrwxrwx 1 root root 36 Aug 29 2021 dav.load -> /etc/apache2/mods-available/dav.load lrwxrwxrwx 1 root root 30 Aug 29 2021 deflate.conf -> ../mods-available/deflate.conf lrwxrwxrwx 1 root root 30 Aug 29 2021 deflate.load -> ../mods-available/deflate.load lrwxrwxrwx 1 root root 26 Aug 29 2021 dir.conf -> ../mods-available/dir.conf lrwxrwxrwx 1 root root 26 Aug 29 2021 dir.load -> ../mods-available/dir.load lrwxrwxrwx 1 root root 26 Aug 29 2021 env.load -> ../mods-available/env.load lrwxrwxrwx 1 root root 28 Aug 29 2021 fcgid.conf -> ../mods-available/fcgid.conf lrwxrwxrwx 1 root root 28 Aug 29 2021 fcgid.load -> ../mods-available/fcgid.load lrwxrwxrwx 1 root root 29 Aug 29 2021 filter.load -> ../mods-available/filter.load lrwxrwxrwx 1 root root 30 May 14 01:21 headers.load -> ../mods-available/headers.load lrwxrwxrwx 1 root root 52 Aug 29 2021 lbmethod_byrequests.load -> /etc/apache2/mods-available/lbmethod_byrequests.load lrwxrwxrwx 1 root root 27 Aug 29 2021 mime.conf -> ../mods-available/mime.conf lrwxrwxrwx 1 root root 27 Aug 29 2021 mime.load -> ../mods-available/mime.load lrwxrwxrwx 1 root root 32 Aug 29 2021 mpm_event.conf -> ../mods-available/mpm_event.conf lrwxrwxrwx 1 root root 32 Aug 29 2021 mpm_event.load -> ../mods-available/mpm_event.load lrwxrwxrwx 1 root root 34 Aug 29 2021 negotiation.conf -> ../mods-available/negotiation.conf lrwxrwxrwx 1 root root 34 Aug 29 2021 negotiation.load -> ../mods-available/negotiation.load lrwxrwxrwx 1 root root 47 Aug 29 2021 proxy_balancer.conf -> /etc/apache2/mods-available/proxy_balancer.conf lrwxrwxrwx 1 root root 47 Aug 29 2021 proxy_balancer.load -> /etc/apache2/mods-available/proxy_balancer.load lrwxrwxrwx 1 root root 38 Aug 29 2021 proxy.conf -> /etc/apache2/mods-available/proxy.conf lrwxrwxrwx 1 root root 46 Aug 29 2021 proxy_connect.load -> /etc/apache2/mods-available/proxy_connect.load lrwxrwxrwx 1 root root 43 Aug 29 2021 proxy_fcgi.load -> /etc/apache2/mods-available/proxy_fcgi.load lrwxrwxrwx 1 root root 43 Aug 29 2021 proxy_http.load -> /etc/apache2/mods-available/proxy_http.load lrwxrwxrwx 1 root root 38 Aug 29 2021 proxy.load -> /etc/apache2/mods-available/proxy.load lrwxrwxrwx 1 root root 33 Aug 29 2021 reqtimeout.conf -> ../mods-available/reqtimeout.conf lrwxrwxrwx 1 root root 33 Aug 29 2021 reqtimeout.load -> ../mods-available/reqtimeout.load lrwxrwxrwx 1 root root 40 Aug 29 2021 rewrite.load -> /etc/apache2/mods-available/rewrite.load lrwxrwxrwx 1 root root 31 Aug 29 2021 setenvif.conf -> ../mods-available/setenvif.conf lrwxrwxrwx 1 root root 31 Aug 29 2021 setenvif.load -> ../mods-available/setenvif.load lrwxrwxrwx 1 root root 44 Aug 29 2021 slotmem_shm.load -> /etc/apache2/mods-available/slotmem_shm.load lrwxrwxrwx 1 root root 36 Aug 29 2021 socache_shmcb.load -> ../mods-available/socache_shmcb.load lrwxrwxrwx 1 root root 26 Aug 29 2021 ssl.conf -> ../mods-available/ssl.conf lrwxrwxrwx 1 root root 26 Aug 29 2021 ssl.load -> ../mods-available/ssl.load lrwxrwxrwx 1 root root 29 Aug 29 2021 status.conf -> ../mods-available/status.conf lrwxrwxrwx 1 root root 29 Aug 29 2021 status.load -> ../mods-available/status.load lrwxrwxrwx 1 root root 39 Aug 29 2021 suexec.load -> /etc/apache2/mods-available/suexec.load lrwxrwxrwx 1 root root 27 May 15 23:06 wsgi.conf -> ../mods-available/wsgi.conf lrwxrwxrwx 1 root root 27 May 15 23:06 wsgi.load -> ../mods-available/wsgi.load
Im using code from menu but not working :(
ok, also, check you have this
root@mcintyre:/etc/apache2# ls -la /etc/apache2/conf-*/serve-cgi-bin.conf
-rw-r--r-- 1 root root 455 Sep 30 2020 /etc/apache2/conf-available/serve-cgi-bin.conf
lrwxrwxrwx 1 root root 36 Oct 9 2021 /etc/apache2/conf-enabled/serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
and put the tvh_epg.py into the /usr/lib/cgi-bin/ directory
root@cloud:/home/player/cgi-bin# ls -la /etc/apache2/conf-*/serve-cgi-bin.conf -rw-r--r-- 1 root root 455 Jul 5 2021 /etc/apache2/conf-available/serve-cgi-bin.conf lrwxrwxrwx 1 root root 36 Aug 29 2021 /etc/apache2/conf-enabled/serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf
and put the tvp_epg.py into the /usr/lib/cgi-bin/ directory
Its running in virtual host my dir is /home/player/cgi-bin
you can use a different cgi-bin dir, but have to change the serve-cgi-bin.conf file to suit
ok, well, whatever vhost you have set up, you need this sort of thing
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
I have to finish now, as it's late, I will come back to see if you've made progress
Changed dir and no difference. I think it need python3. Its late her to so try again tomorrow
setup new server i get:
[Tue May 17 09:25:26.178959 2022] [wsgi:error] [pid 2714] [client 192.168.1.102:61505] mod_wsgi (pid=2714, process='', application='127.0.1.1|/tv'): Failed to parse WSGI script file '/var/www/scripts/tvh_epg.py'. [Tue May 17 09:25:26.179101 2022] [wsgi:error] [pid 2714] [client 192.168.1.102:61505] mod_wsgi (pid=2714): Exception occurred processing WSGI script '/var/www/scripts/tvh_epg.py'. [Tue May 17 09:25:26.179332 2022] [wsgi:error] [pid 2714] [client 192.168.1.102:61505] File "/var/www/scripts/tvh_epg.py", line 579 [Tue May 17 09:25:26.179364 2022] [wsgi:error] [pid 2714] [client 192.168.1.102:61505] '<img src="%s"' % (chan_img_url, ), end='') [Tue May 17 09:25:26.179391 2022] [wsgi:error] [pid 2714] [client 192.168.1.102:61505] ^ [Tue May 17 09:25:26.179417 2022] [wsgi:error] [pid 2714] [client 192.168.1.102:61505] SyntaxError: invalid syntax
this is not a mod_wsgi program, this is a dumb cgi-bin program in the oldest fashioned way possible, the web server spawns a sub process to run this.
make sure you only have the cgid module loaded
paulm@mcintyre:~/git/tvh_epg$ ls /etc/apache2/mods-enabled/
access_compat.load auth_basic.load authn_file.load authz_host.load autoindex.load deflate.conf dir.load headers.load mime.conf mpm_event.load reqtimeout.conf setenvif.load ssl.load
alias.conf auth_digest.load authz_core.load authz_user.load cgid.conf deflate.load env.load info.conf mime.load negotiation.conf reqtimeout.load socache_shmcb.load status.conf
alias.load authn_core.load authz_groupfile.load autoindex.conf cgid.load dir.conf filter.load info.load mpm_event.conf negotiation.load setenvif.conf ssl.conf status.load
work now it seems
I'm glad you got it working, and since you've not reported any more problems, I'm closing this.
Just get this error in log: `
KeyError | Python 3.8.10: /usr/bin/python3Sun May 15 20:38:19 2022 -- | --KeyError: 'user'
args = ('user',)
with_traceback = <built-in method with_traceback of KeyError object>
KeyError Python 3.8.10: /usr/bin/python3 Sun May 15 20:38:19 2022 A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/home/player/cgi-bin/tvh_epg.py in
1613 cgitb.enable(display=0, logdir=DOCROOT + '/python_errors', format='html')
1614
=> 1615 web_interface()
1616
1617 else:
web_interface =
/home/player/cgi-bin/tvh_epg.py in web_interface()
1548 html_page_footer()
1549 elif p_page == 'error':
=> 1550 html_page_header()
1551 page_error(error_text)
1552 html_page_footer()
global html_page_header =
/home/player/cgi-bin/tvh_epg.py in html_page_header()
1332
1333 bg_col_page = BG_COL_DEF_PAGE
=> 1334 if BG_COL_PAGE in MY_SETTINGS[SETTINGS_SECTION] and MY_SETTINGS.get(SETTINGS_SECTION, BG_COL_PAGE) != '':
1335 bg_col_page = MY_SETTINGS.get(SETTINGS_SECTION, BG_COL_PAGE)
1336
global BG_COL_PAGE = 'bg_col_page', global MY_SETTINGS = , global SETTINGS_SECTION = 'user', MY_SETTINGS.get = <bound method RawConfigParser.get of >
/usr/lib/python3.8/configparser.py in getitem(self=, key='user')
958 def getitem(self, key):
959 if key != self.default_section and not self.has_section(key):
=> 960 raise KeyError(key)
961 return self._proxies[key]
962
builtin KeyError = <class 'KeyError'>, key = 'user'
KeyError: 'user'
args = ('user',)
with_traceback = `