Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send python variable to subprocess #11325

Closed
bokiroki opened this issue Nov 30, 2016 · 1 comment
Closed

Send python variable to subprocess #11325

bokiroki opened this issue Nov 30, 2016 · 1 comment

Comments

@bokiroki
Copy link

@bokiroki bokiroki commented Nov 30, 2016

Hi i cant find simple answer how to send variable to cmd from python in subrocess.call, variable is url.

from tkinter import Tk
mis = Tk()
adresa = mis.clipboard_get()

import requests
from bs4 import BeautifulSoup
r = requests.get(adresa)
r.content
soup = BeautifulSoup(r.content, "html.parser")
print (soup.prettify())
soup.find_all("iframe", class_="mfp-iframe")
for link in soup.find_all("iframe", class_="mfp-iframe"):
print (link.get("src"))

video = (link.get("src"))

import subprocess
subprocess.call('C:\Users\Boris\Desktop\youtube-dl.exe 'print (video)' -f mp4 -o C:/Users/Boris/Desktop/%(title)s --write-sub --convert-subs srt', shell=True)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 30, 2016

LIke this:

subprocess.call('youtube-dl ' + video + ' -o foo.mp4')
@yan12125 yan12125 closed this Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.