Try using os.system
:
os.system("script2.py 1")
execfile
is different because it is designed to run a sequence of Python statements in the current execution context. That’s why sys.argv
didn’t change for you.
More Related Contents:
- Python, How to remove gaps between text and variable?
- How do I list all files of a directory?
- Aggregation in Pandas
- Instance variables vs. class variables in Python
- How can I split and parse a string in Python?
- Iterating through list of list in Python
- Reversing a regular expression in Python
- How does my input not equal the answer?
- How to remove whitespaces and newlines from every value in a JSON file?
- Joining strings. Generator or list comprehension?
- using Python logger class to generate multiple logs for different log levels
- multiprocessing.pool.MaybeEncodingError: ‘TypeError(“cannot serialize ‘_io.BufferedReader’ object”,)’
- TensorFlow ValueError: Cannot feed value of shape (64, 64, 3) for Tensor u’Placeholder:0′, which has shape ‘(?, 64, 64, 3)’
- Python and how to get text from Selenium element WebElement object?
- IPython: redirecting output of a Python script to a file (like bash >)
- Loading multiple csv files of a folder into one dataframe
- How to make two plots side-by-side
- How to find tag with particular text with Beautiful Soup?
- How should I write a Windows path in a Python string literal?
- Format numbers in django templates
- Saving and loading objects and using pickle
- Python – Homework – Converting Any Base to Any Base
- what url should I authorize to use pip behind a firewall?
- Numpy sub-array assignment with advanced, mixed indexing
- How to sort a 2D list? [closed]
- TypeError: ‘WebElement’ object is not iterable error
- beautiful soup just get the value inside the tag
- python exception handling
- Excel, How to split cells by comma delimiter into new cells
- Algorithm for solving Sudoku