Hi, I am not a python newbie, but I am by no means an expert or a tech artist. I would say I am more on the power user side. So I work mostly as an 3D Artist who can write his own tools. I have been banging my head on a problem for about too days now and I think I just need some help.
I am trying to execute and external Python script from the Maya script editor in its own command prompt using subprocess
Code exectued in Maya script Editor
import subprocess
import os
subprocess.Popen([‘C:\Python27\python.exe’,‘C:\Scripts\a.py’],shell=True)
The script executes and I hear a beep but the a.py file does not execute. This is the basic code that is happening in the a.py file
Simple creation of a txt file
import os.path
save_path = ‘C:/Scripts/’
name_of_file = raw_input(“What is the name of the file: “)
completeName = os.path.join(save_path, name_of_file+”.txt”)
file1 = open(completeName, “w”)
toFile = raw_input(“Write what you want into the field”)
file1.write(toFile)
file1.close()
So the confusing thing is it runs in PyCharm IDE but not in Maya. I must be making a simple mistake that is usually the case. Any help would be appreciated.
Thanks