Home > Back-end >  Python URL call using xdg Linux command
Python URL call using xdg Linux command

Time:07-09

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)

CodePudding user response:

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}')
  • Related