Python URL call using xdg Linux command


I have been trying to get this simple url call Linux command to run as a python script. However, I keep getting an error for too many arguments in the system() module. Is there is easy fix still using this technique?

import sys
import os
g = str(input('enter search '))
os.system('xdg-open https://',g)


format the command as a single string instead of 2 parameters

import sys 
import os

search = str(input('enter search')) 
os.system(f'xdg-open https://{search}')

Answered By – smcrowley

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published