0

Suppose, I have a python script test1.py , executing of test1.py will create a copy of that file, let's say test2.py . Now, I want to run test1.py in such a way that first it will create test2.py and then will execute test2.py .

This is my test1.py python script looks like,

import io
import shutil
import os

shutil.copy2('test1.py', 'test2.py')
os.system("test2.py")

But out is saying test2.py: not found

1
  • 3
    Try using the complete path during the script creation and execution. Commented Sep 4, 2016 at 23:23

1 Answer 1

1

Run python with test2.py as it's first argument.

os.system("python test2.py")

If you say what's your goal of this action. We can help you better.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.