0

I have a python script that runs a program, which generates few .exe files and puts them in a folder. I want to access these exe files to do further testing, the problem is that this folder name is not static (it's dynamic? ), the name depends on the OS,compiler,binary type(64/32-bit), so I can't hard code the directory.

So What is the best to access folders like this? , I tried looking this up but I haven't got a clue as to how to approach this.

2 Answers 2

1

Just pass the folder name as a parameter to your python script:

python myscript.py FolderName

In myscript.py:

import sys
print sys.argv[1]

sys.argv gives you all the parameters.

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

Comments

0
import platform

Use the platform module to generate the file path.

import os.path

Use the os.path module to play with paths in a nice way.

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.