sudoPassword = 'mypass' command = 'mount -t vboxsf myfolder /home/myuser/myfolder' p = os.system('echo %s|sudo -S %s' % (sudoPassword, command))
Try this and let me know if it works. 🙂
And this one:
os.popen("sudo -S %s"%(command), 'w').write('mypass')
Related Posts:
- python getoutput() equivalent in subprocess
- How to execute a program or call a system command?
- Should I put #! (shebang) in Python scripts, and what form should it take?
- Should I put #! (shebang) in Python scripts, and what form should it take?
- Why do people write #!/usr/bin/env python on the first line of a Python script?
- Is there a Python equivalent to the ‘which’ command
- Running shell command and capturing the output
- Shell Script: Execute a python program from within a shell script
- Meaning of “! -S” in shell script
- “No such file or directory” but it exists
- How do I split a string on a delimiter in Bash?
- Ubuntu says “bash: ./program Permission denied” [closed]
- How do I copy a folder from remote to local using scp?
- How to concatenate string variables in Bash
- -bash: syntax error near unexpected token `)’
- An example of how to use getopts in bash
- OSError: [WinError 193] %1 is not a valid Win32 application
- How to delete from a text file, all lines that contain a specific string?
- How to mkdir only if a directory does not already exist?
- OSError: [Errno 8] Exec format error
- How do I iterate over a range of numbers defined by variables in Bash?
- Why do people write #!/usr/bin/env python on the first line of a Python script?
- How to set ssh timeout?
- commands not found on zsh
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- subprocess.check_output return code
- sudo: apt-get: command not found
- How do I iterate over a range of numbers defined by variables in Bash?
- How to mkdir only if a directory does not already exist?
- Using find to locate files that match one of multiple patterns
- “unary operator expected” error in Bash if condition
- takes 1 positional argument but 2 were given
- What does “-ne” mean in bash?
- How to generate random number in Bash?
- How to check if a variable is set in Bash?
- Who can access a file with octal permissions “000” on Linux/UNIX?
- How can I compare numbers in Bash?
- What does the line “#!/bin/sh” mean in a UNIX shell script?
- Open and write data to text file using Bash?
- Python error – IDLE’s subprocess didn’t make connection. Either IDLE can’t start or personal firewall software is blocking connection
- How do I set a variable to the output of a command in Bash?
- What is the $? (dollar question mark) variable in shell scripting?
- Is there a TRY CATCH command in Bash
- What can lead to “IOError: [Errno 9] Bad file descriptor” during os.system()?
- dquote> result of a execution a program in linux shell
- how to fix the issue “Command /bin/sh failed with exit code 1” in iphone
- Run a string as a command within a Bash script
- Python Subprocess: Too Many Open Files
- conditional binary operator expected in shell script
- Is there any simple way to benchmark Python script?
- Block Comments in a Shell Script
- how to check which version of nltk, scikit learn installed?
- How to get a shell environment variable in a makefile?
- What are the uses of the exec command in shell scripts?Â
- using rot13 and tr command for having an encrypted email address
- sed whole word search and replace
- What’s the difference betwen the single dash and double dash flags on shell commands?
- How to let ‘cp’ command don’t fire an error when source file does not exist?
- SyntaxError: unexpected EOF while parsing
- How do I lowercase a string in Python?
- How do I copy a file in Python?
- How can I reverse a list in Python?
- Manually raising (throwing) an exception in Python
- How do I copy a file in Python?
- can’t multiply sequence by non-int of type ‘float’
- Difference between del, remove, and pop on lists
- How can I reverse a list in Python?
- How to use the pass statement
- How to use filter, map, and reduce in Python 3
- What does enumerate() mean?
- Searching the student-t distribution table for values using python
- How to declare an array in Python?
- Does Python have a ternary conditional operator?
- Use Gif Logo For Loading Screen In Kivy
- Praw & Discord.py: The bot keep sending the same meme. I want the bot to send different meme whenever it is asked
- Pig Latin Translator
- What is the difference between Python’s list methods append and extend?
- How can I make a time delay in Python? [duplicate]
- Python – TypeError: ‘int’ object is not iterable
- TypeError: ‘int’ object is not subscriptable
- sphinx.ext.autodoc: Keeping names of constants in signature
- are there dictionaries in javascript like python?
- How do you round UP a number?
- Understanding slice notation
- Iterating over dictionaries using ‘for’ loops
- How to define a two-dimensional array?
- how to sort pandas dataframe from one column
- Why am I seeing “TypeError: string indices must be integers”?
- Understanding the main method of python [duplicate]
- How do you round UP a number?
- Understanding slice notation
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How do I update\upgrade pip itself from inside my virtual environment?
- How to use execvp()
- How to open a file using the open with statement
- How to emulate a do-while loop?
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How do I update\upgrade pip itself from inside my virtual environment?
- How to comment out a block of code in Python [duplicate]
- Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)