obsproject / obsproject/obs-studio

Python scripting 'stderr_logger' does not reimplement 'isatty'

Open
#4,628 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue/confirmed
Dominant language
C
Stars
76.4k
Forks
10.2k
Avg merge
4d 23h
Merged PRs (30d)
12

Description

Operating System Info

Other

Other OS

Manjaro Linux, Kernel 5.12

OBS Studio Version

26.1.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

None

OBS Studio Crash Log URL

Not crashed

Expected Behavior

Want to use the Python package youtube_dl inside my OBS Script.

Current Behavior

Throws a Python Error AttributeError: 'stderr_logger' object has no attribute 'isatty' in the Script Log window.
See: https://github.com/ytdl-org/youtube-dl/issues/28914

Steps to Reproduce
  1. Create a simple script barebone.
  2. import youtube_dl package.
  3. Instantiate it by parser = youtube_dl.YoutubeDL(...).
  4. Call it by: parser.extract_info(...).

In contrast, running the following standalone example script outside of OBS wil NOT reproduce the issue:

#!/usr/bin/env python3
import youtube_dl as ydl

url = "https://www.youtube.com/watch?v=6qEzh3wKVJc"

with ydl.YoutubeDL(
    {
        "forcejson": True,
        "noplaylist": True,
        "format": "bestaudio"
    }
) as parser:
    meta = parser.extract_info(
        url,
        download=False
    )

print(meta['thumbnail'])
print(meta['title'])
print(meta['url'])
Anything else we should know?

Workaround: https://github.com/ytdl-org/youtube-dl/issues/28914#issuecomment-829739392

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Python scripting logger implementation for the stderr_logger object and reproduce the error by importing youtube_dl and calling YoutubeDL.extract_info(...) from an OBS script. The work is done when that interaction no longer raises the missing isatty error and the relevant script-logging behavior is covered by an appropriate test, if one exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.