Can see PC videos from Tivo when pytivo is running from console but not from service

Discussion in 'TiVo Home Media Features & TiVoToGo' started by John Cavanaugh, Jan 7, 2012.

  1. Jan 7, 2012 #1 of 26
    John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    New Premier Elite (14.9.2-01-2-758)
    New pytivo,python and pywin install (python 2.7.2, latest pytivo, pywin32-216.win32-py2.7)

    If I start pytivo from the console (pytivo.py) I can see my PC share on the Tivo and download videos just fine. However, if I am running pytivo as a service I see the MyMovies folder on the Tivo but nothing is in it.

    pytivo.conf:

    [Server]
    port = 9032
    ffmpeg = C:\pytivo\bin\ffmpeg.exe
    tivo_mak = xxx
    tivo_password = xxx
    tivo_username = xxx
    togo_path = f:\media
    tivodecode = c:\pytivo\bin\tivodecode.exe
    tdcat = c:\pytivo\bin\tivodecode.exe

    [MyMovies]
    type = video
    path = f:\media

    [_tivo_SD]

    [_tivo_HD]

    log.txt:

    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 88
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 39
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 94
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 69
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 73

    I've also found that when I try to stop the service in Windows it tells me that it can't stop the service, but the services window shows it stopped - and then I can restart it.

    I've walked through the troubleshooting page for pytivo and everything from that works fine (well other than it working as a service) - I can get to the web interface and make changes there without issue. If things are running from the command window, I don't see any errors:

    C:\pytivo>pytivo.py
    INFO:pyTivo.beacon:Announcing shares...
    INFO:pyTivo.beacon:Registering: MyMovies
    INFO:pyTivo.beacon:Scanning for TiVos...
    INFO:pyTivo:pyTivo is ready.
    INFO:pyTivo:192.168.1.137 [07/Jan/2012 15:29:05] "GET /TiVoConnect?Command=Query
    Container&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.137 [07/Jan/2012 15:29:07] "GET /TiVoConnect?Command=Query
    Formats&SourceFormat=video%2Fx-tivo-mpeg HTTP/1.1" 200 -
    INFO:pyTivo:192.168.1.137 [07/Jan/2012 15:29:07] "GET /TiVoConnect?Command=Query
    Container&Container=MyMovies&SortOrder=!CaptureDate&ItemCount=8&Filter=x-tivo-co
    ntainer%2Ftivo-videos,x-tivo-container%2Ffolder,video%2Fx-tivo-mpeg,video%2F*&Se
    rialNum=7582001901FAE59 HTTP/1.1" 200 -
    INFO:pyTivo:192.168.1.137 [07/Jan/2012 15:29:39] "GET /TiVoConnect?Command=Query
    Formats&SourceFormat=video%2Fx-tivo-mpeg HTTP/1.1" 200 -
    INFO:pyTivo:192.168.1.137 [07/Jan/2012 15:29:39] "GET /TiVoConnect?Command=Query
    Container&Container=MyMovies&SortOrder=!CaptureDate&ItemCount=8&Filter=x-tivo-co
    ntainer%2Ftivo-videos,x-tivo-container%2Ffolder,video%2Fx-tivo-mpeg,video%2F*&Se
    rialNum=7582001901FAE59 HTTP/1.1" 200 -
    INFO:pyTivo:192.168.1.137 [07/Jan/2012 15:30:23] "GET /TiVoConnect?Command=Query
    Container&Container=MyMovies&SortOrder=!CaptureDate&ItemCount=8&Filter=x-tivo-co
    ntainer%2Ftivo-videos,x-tivo-container%2Ffolder,video%2Fx-tivo-mpeg,video%2F*&Se
    rialNum=7582001901FAE59 HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:31:05] "GET / HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:31:05] "GET /main.css HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:31:05] code 404, message Not Found
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:31:05] "GET /favicon.ico HTTP/1.1" 404 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:35:39] "GET /TiVoConnect?Command=Settings&
    Container=Settings HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:35:39] "GET /main.css HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:35:39] "GET /plugins/settings/settings.css
    HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:35:39] "GET /plugins/settings/settings.js
    HTTP/1.1" 200 -
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:35:39] code 404, message Not Found
    INFO:pyTivo:127.0.0.1 [07/Jan/2012 15:35:39] "GET /favicon.ico HTTP/1.1" 404 -

    Ideas?

    Thanks.
     
  2. Jan 7, 2012 #2 of 26
    ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,897
    972
    Apr 6, 2000
    SF Bay Area
    I just compared your pytivo.conf with mine and the only difference is there is an extra line "tdcat="
     
  3. Jan 7, 2012 #3 of 26
    John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Wait, you have two "tdcat=" lines?

    I have one in my conf file:

    tdcat = c:\pytivo\bin\tivodecode.exe

    Which I just saw was wrong, it should say:

    tdcat = c:\pytivo\bin\tdcat.exe

    I fixed that but i've still get errors in my log file when running as a service:

    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 88
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 39
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 94
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 69
     
  4. Jan 7, 2012 #4 of 26
    ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,897
    972
    Apr 6, 2000
    SF Bay Area
    I do not any "tdcat=" line under the [server] line.

    Also, I do not even have pytivo\bin\tdcat.exe

    (Perhaps because my PyTivo is the WmcBrine version)
     
  5. Jan 7, 2012 #5 of 26
    John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Hmm...ok, I could try removing that line for mine. I am running the latest wmcbrine version as well.
     
  6. Jan 7, 2012 #6 of 26
    wmcbrine

    wmcbrine Well-Known Mumbler

    11,704
    813
    Aug 2, 2003
    That line is not the issue. Please, let's not treat pyTivo.conf as a magical incantation. All that line does is tell pyTivo where tdcat is... and since that's the default location, the line is basically redundant.

    John Cavanaugh, your log.txt (from service mode) is saying that the logging module can't write to the log file. Since no log file is specified in the pyTivo.conf file you've shown, I have to wonder if the service mode isn't actually using a different conf file.
     
  7. Jan 7, 2012 #7 of 26
    ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,897
    972
    Apr 6, 2000
    SF Bay Area
    I have debug.log as the log file and only noticed an error and it was saying it is missing a 'type=' for auto-push.
     
  8. Jan 7, 2012 #8 of 26
    ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,897
    972
    Apr 6, 2000
    SF Bay Area
    Do you have this in pytivo.conf? If not, copy/paste and change the path, if needed.

    [handler_rotfile]
    formatter = basicform
    class = handlers.RotatingFileHandler
    args = ('C:\pyTivo\debug.log', 'a', 10485760, 5)
     
  9. Jan 7, 2012 #9 of 26
    John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Interesting. I followed the directions on the wiki to set things up, so I took the stock conf file, copied it to pytivo.conf and then edited it with the web interface. Once I did that it removed everything except what I listed in my original message.

    I'll try taking the handler_rotfile section from ThAbtO's message, copying that in and see if it makes a difference. Thanks.
     
  10. John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Stopped the service (still getting an error stopping it), copied the rotfile section from above into my pytivo.conf, started the service and i'm still getting the following in my log.txt file:

    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 88
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 39
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 94
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 69

    It does look like it's ignoring the new section as things are going to the log.txt and not the debug.txt as i've specified.

    Hmmm....
     
  11. ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,897
    972
    Apr 6, 2000
    SF Bay Area
    The log all seem to point to 1 thing:

    File "C:\Python27\lib\logging\__init__.py"

    Python 2.7 and if I remember correctly, there were problems with that version and PyTivo.

    I have version 2.6.
     
  12. wmcbrine

    wmcbrine Well-Known Mumbler

    11,704
    813
    Aug 2, 2003
    There are NOT problems with that version and pyTivo. The only problem was with the "Windows Installer" package not finding it. That package is long obsolete.
     
  13. John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Thanks for the update wmcbrine. Do you have any other ideas of what I can do/try to get things to work?

    Thanks.
     
  14. windracer

    windracer joined the 10k club

    12,267
    218
    Jan 3, 2003
    St. Pete, FL
    Is the service running with administrator rights? Maybe it doesn't have permission to write to the logfile location?
     
  15. John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Good thought - and i'll confirm it tonight when I get home but I don't think that's it. This is an XP box and i'm the only user - and i'm an admin. :)

    [Edit: But I don't think I opened the DOS box to install the service "as an administrator".]

    Thanks.
     
  16. John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    pyTivo service is using the local system account...so I don't think it's a privilege issue.
     
  17. John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Ok. Had some more time to play with this today. Ripped everything out and started over again. Grabbed the latest packages (Python 2.7.2, the latest wmcbrine and pywin32-216.win32-py2.7.exe packages) installed then per the wiki and i'm getting the same results - can see things on the Tivo under MyMovies if I run pytivo from the console but not when I run it as a service.

    There has been a change in behavior though - when I run pytivo from the console, all of the entries in my f:\media directory are listed as if they all exist in the root of that directory instead of listing all of the directories in f:\media.

    pytivo.conf:

    [Server]
    port = 9032
    ffmpeg = c:\pyTivo\bin\ffmpeg.exe
    tivo_mak = xxx
    tivo_password = xxx
    tivo_username = xxx
    togo_path = f:\media

    [MyMovies]
    type = video
    path = f:\media

    [_tivo_SD]

    [_tivo_HD]

    output from log.txt:

    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 88
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 39
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 94
    Traceback (most recent call last):
    File "C:\Python27\lib\logging\__init__.py", line 866, in emit
    self.flush()
    File "C:\Python27\lib\logging\__init__.py", line 828, in flush
    self.stream.flush()
    IOError: [Errno 9] Bad file descriptor
    Logged from file beacon.py, line 69

    Tried to put the logging section that ThAbtO recommended, stopped and restarted the server and I still get the same output error messages - in log.txt and not debug.txt.

    Anyone have any other ideas?

    Thanks.
     
  18. ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,897
    972
    Apr 6, 2000
    SF Bay Area
    Is that the complete pytivo.conf file? my file is considerably longer.
     
  19. John Cavanaugh

    John Cavanaugh Member

    42
    0
    Dec 29, 2006
    Hillsboro,...
    Thanks for the reply. Yes, that's the whole file.

    The pytivo.conf.dist file looks like this:

    # This is an example config file, showing all the options. You probably
    # won't need most of them. Your working config file will be named
    # "pyTivo.conf". '#' starts a comment. It is recommended that
    # that you use the Web Administration tool to modify pyTivo.conf after
    # you get pyTivo up and running. You can access the tool by pointing your
    # browser to http://localhost:9032/

    [Server]
    port=9032

    # Full path to ffmpeg including filename
    # For windows: ffmpeg=c:\Program Files\pyTivo\bin\ffmpeg.exe
    # For linux: ffmpeg=/usr/bin/ffmpeg
    #ffmpeg=c:\Program Files\pyTivo\bin\ffmpeg.exe
    ffmpeg=/usr/bin/ffmpeg

    # Setting this to True will log more ouput for debugging purposes.
    #debug=False

    # Max video bitrate, default 30000k
    # sets ffmpeg -maxrate setting to minimize bitrate peak playback issues.
    # mpegs with video bitrate above this setting will also be transcoded.
    #MAX_VIDEO_BR=17408k

    # Audio bit-rate, defaults to 192K for S2, 384K for S3/HD
    #audio_br=320K

    # Video bit-rate, defaults to 4096K for S2, 8192K for S3/HD
    #video_br=12Mi

    # Beacon broadcast address(es)
    # The default is 255.255.255.255, but on some multihomed machines you
    # may need to specify the subnet broadcast address(es) of your Tivo
    # boxes. You can also specify "listen" to listen for direct connection
    # attempts on port 2190, for use with the "Manually add a server..."
    # function. (And if you set beacon to listen _only_, it turns off
    # broadcasts.)
    #beacon=192.168.1.255 listen

    # Output Pixel Width:
    # Width, defaults to 544 for S2, 1920 for S3/HD
    # Height, defaults to 480 for S2, 1080 for S3/HD
    # Valid widths: [S3/HD = 1920, 1440, 1280], [S2/S3/HD = 720, 704, 544, 480, 352]
    # Valid heights: [S3/HD = 1080, 720], [S2/S3/HD = 480]
    #width=1920
    #height=1080
    #ffmpeg_tmpl=%(video_codec)s %(video_fps)s %(video_br)s %(max_video_br)s %(buff_size)s %(aspect_ratio)s %(audio_br)s %(audio_fr)s %(audio_ch)s %(audio_codec)s %(ffmpeg_pram)s %(format)s

    # Togo settings:
    # Set this up if you wish to have TiVo ToGo support. This allows you to
    # copy videos from your TiVo via a web page.
    #
    #tivo_mak=<Your Media Access Key>
    #togo_path=<path where movies will go or a section name>

    # Per tivo options
    # section named _tivo_TSN with the tsn in all caps
    #[_tivo_00000DEADBEEF]

    # If you want to use 16:9 or 4:3 on this tivo
    #aspect169=true

    #width=1440
    #height=720
    #audio_br=320K
    #video_br=12Mi
    #ffmpeg_tmpl=%(video_codec)s %(video_fps)s %(video_br)s %(max_video_br)s %(buff_size)s %(aspect_ratio)s %(audio_br)s %(audio_fr)s %(audio_ch)s %(audio_codec)s %(ffmpeg_pram)s %(format)s

    #[_tivo_HD]
    # section for default video options applicable to all HD TiVos
    # see pyTivo Web Configuration for all available settings

    #[_tivo_SD]
    # section for default video options applicable to all SD TiVos
    # see pyTivo Web Configuration for all available settings

    [MyMovies]
    # Type can be 'video', 'music', or 'photo'
    type=video

    # Path is the full path to your files (No trailing slash needed)
    # For windows: path=c:\videos
    # For linux: path=/media
    path=/home/armooo/Videos

    # You can have more than one share
    #[MyTelevision]
    #type=video
    #path=d:\television

    As per the Wiki, I copied this file to pytivo.conf, started the service, went into the web interface and updated the ffmpeg path, tivo_username, tivo_password, tivo_mak and togo_path in the Global Server Settings and then the path in the MyMovies section. Saved everything and did a soft reset. The resulting pytivo.conf file is what I listed above.
     
  20. Speed Daemon

    Speed Daemon New Member

    78
    0
    Jan 15, 2012
    I'm not familiar with pytivo, and don't know how the Windows service is being created. I can only assume that the software includes the correct tools. One thought is that since Python is an interpreter, you'll want to make sure that the Python files have the right permissions as well.

    As a general rule, I start at each top level directory and first take ownership recursively as Administrator, with full permissions. It's important to do this as THE Administrator, not just as a member of the Administrators group, because some arcane things can only be done by Administrator. Next, change the group permissions recursively to full permissions for Administrators, SYSTEM and SERVICE. Don't inherit any other owners or groups. Once this is done, install the service.

    BTW, if you need to run a command line to install the service, be sure to use the Windows command interpreter, CMD.EXE, and not a "DOS box" (COMMAND.COM). Again, it's best to do this as Administrator, not just as a member of the Administrators group.
     

Share This Page