0

I have a python script containing vraibles example.py

"src = komponent/cool,
       komponent/raw"  /* path of source files */

and i have a batch file which needs to import the value of "src" for postporcessing example.bat

--cs-include ='komponent/cool'* --cs-include ='komponent/raw'*

Is there any way to import directly between files (without using any other conversion) ? "PyBat.bat" is one option but i am trying to figure out a better choice dont want to add on one more tool (not specifically)...as my project itself has too different files and interacting source.

Any help is appreciated.. Thank you in advance..!!!

3
  • Why not pass the values of src into the python file (and the batch file)? Commented Aug 22, 2013 at 7:22
  • Before compiling need to run the batch file..so necessary to includes. My python file is so called static, the batch needs to be modified accordingly with once example.py changed Commented Aug 22, 2013 at 7:31
  • I don't think you can see if directly, without text parsing, but you can pass variables into a batch file. Commented Aug 22, 2013 at 7:34

2 Answers 2

1

In Python
Create a temp batch file in %TEMP%\setvars.bat containing SET commands to set environment vars. You could use subprocess.POpen to run an ECHO something > path batch command so that %TEMP% can be used.

In Batch
Call the temp batch file : the vars are now available to use.

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

Comments

0

Solution is... 1.set a argument in the python itself. 2.call the batch file from python script and along with pass the argument using os.system(cmd) and cmd as a string.

It will set the path itself.

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.