Search code examples
pythonlinuxubuntutwitch

Using livestreamer to record in ubuntu


i'm having a really hard time trying to figure this out since i don't code in python or use linux. So my problem here is this, i have a python script the will run checking if there's a user online on twitch, if he is livestreamer will start recording. Works just fine in Windows, but now i'm trying to make work on linux ubuntu and i have this error:

File "billowy.py", line 97, in <module>
    main()   File "billowy.py", line 76, in main
    dir_path = '%s\livestreamer\livestreamerrc' % os.environ['APPDATA']   File "/usr/lib/python3.4/os.py", line 631, in
__getitem__
    raise KeyError(key) from None KeyError: 'APPDATA'

Full script: http://pastebin.com/tDVrwcmh


Solution

  • a. Copy file 'livestreamerrc' for Windows in Linux ~/.livestreamerrc or create new file touch ~/.livestreamerrc

    b. Line 76

    dir_path = '%s\livestreamer\livestreamerrc' % os.environ['APPDATA']
    

    change

    if os.name == 'nt':
        dir_path = '%s\livestreamer\livestreamerrc' % os.environ['APPDATA']
    elif os.name == 'posix':
        dir_path = '%s/.livestreamerrc' % os.getenv("HOME")