Ask Your Question
0

Python: How to fix "got an unexpected keyword argument 'capture_output'"?

asked 2023-04-14 13:44:24 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-04-14 13:45:07 +0000

qstack gravatar image

updated 2023-04-15 11:33:29 +0000

It seems you are encountering an error in your Python script (convertvideogen.py). The error is caused by an unexpected keyword argument capture_output in the subprocess.run() function.

The captureoutput argument was introduced in Python 3.7. Since your error message indicates you are using Python 3.6, you need to use an alternative approach to capture the output. Instead of using captureoutput=True, you can use stdout and stderr arguments with subprocess.PIPE.

Here's how you can modify the subprocess.run() function call in your script:

result = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)

This change should fix the TypeError in your script.

If you still want to use the capture_output argument, you can consider upgrading your Python version to 3.7 or later. However, before upgrading, make sure that your system and other dependencies are compatible with the newer version of Python.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

1 follower

Stats

Asked: 2023-04-14 13:44:24 +0000

Seen: 17 times

Last updated: Apr 15 '23