Skip to content

Commit

Permalink
Adapted for python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
oumad committed Mar 4, 2018
1 parent 497b395 commit 344befd
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 48 deletions.
13 changes: 5 additions & 8 deletions src/menu/scripts/AE_render/exec.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

import os
import sys
import subprocess

def main(script,myDir,mySel,aerenderExec,compName,startf,endf,incrementf,RStemplate,OMtemplate,outName,outDir,reuse) :
import subprocess
#print script,myDir,mySel,aerenderExec,compName,startf,endf,outName,outDir

#start creating the arguments
args = [aerenderExec,'-project',mySel]

Expand All @@ -30,15 +29,13 @@ def main(script,myDir,mySel,aerenderExec,compName,startf,endf,incrementf,RStempl
if (reuse == 'true'):
args.extend(['-reuse'])

print (args)
#execute the args
subprocess.Popen(args)


if __name__ == '__main__':
import os
import sys
import re

print (*sys.argv)
main(*sys.argv)

"""
Expand Down
8 changes: 4 additions & 4 deletions src/menu/scripts/composite/exec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#python 2.7
#python 3.6
#Script to create a project based on a given template

import os
Expand Down Expand Up @@ -34,7 +34,7 @@ def main(script,myDir,mySel,magickExec,composeType,background,scale,size,quality
outFile = '{0}.{1}'.format(outName,outFormat)
else:
outFile = pre + '_{0}.{1}'.format(composeType,outFormat)
print outFile
print (outFile)


args.extend(['-compose',composeType])
Expand All @@ -59,14 +59,14 @@ def main(script,myDir,mySel,magickExec,composeType,background,scale,size,quality
outRender = os.path.join(myDir,outFile)
args.extend(["-composite",outRender])

print args
print (args)
#execute the args
subprocess.Popen(args)



if __name__ == '__main__':
print sys.argv
print (sys.argv)
main(*sys.argv)

"""
Expand Down
4 changes: 2 additions & 2 deletions src/menu/scripts/imageConvert/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def main(script,myDir,mySel,magickExec,background,scale,size,myFormat,quality,ou
outRender = os.path.join(myDir,outFile)
args.extend([outRender])

print args
print (args)
#execute the args
subprocess.Popen(args)



if __name__ == '__main__':

print sys.argv
print (sys.argv)
main(*sys.argv)
"""
try:
Expand Down
17 changes: 7 additions & 10 deletions src/menu/scripts/mayaRender/exec.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

import subprocess
import os
import sys
import re

def main(script,myDir,mySel,renderExec,renderer,proj,cam,fStart,fEnd,byFrame,xRes,yRes,resPerc,fFormat,outName,outDir) :
import subprocess
#print script,myDir,mySel,aerenderExec,compName,startf,endf,outName,outDir
print myDir,mySel,renderExec,renderer,proj,cam,fStart,fEnd,byFrame,xRes,yRes,resPerc,fFormat,outName,outDir

#start creating the arguments list
args = []
#resolving the magick executable
Expand Down Expand Up @@ -41,19 +40,17 @@ def main(script,myDir,mySel,renderExec,renderer,proj,cam,fStart,fEnd,byFrame,xRe

#append the file path
args.extend([mySel])
print args
print (args)
#execute the args

subprocess.Popen(args)



if __name__ == '__main__':
import os
import sys
import re
print (*sys.argv)
main(*sys.argv)

"""
try:
main(*sys.argv)
Expand Down
6 changes: 3 additions & 3 deletions src/menu/scripts/packImages/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main(script,myDir,mySel,magickExec,background,quality,tiles,margin,maxSize,d
if DisplaySize == "true":
label.append("\\n%wx%h")
if len(label) != 0:
print ''.join(label)
print (''.join(label))
args.extend(["-label",''.join(label)])
args.extend([myFile])

Expand Down Expand Up @@ -78,13 +78,13 @@ def main(script,myDir,mySel,magickExec,background,quality,tiles,margin,maxSize,d
outRender = os.path.join(myDir,outFile)
args.extend([outRender])

print args
print (args)
#execute the args
#subprocess.Popen(args)

p = Popen(args, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
output = p.stdout.read()
print output
print (output)
return output


Expand Down
14 changes: 7 additions & 7 deletions src/menu/scripts/screenshot_loop/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def main(script,monitor,screens,interval,outName,incTime,incDate,outDir,myFormat
magickPath = os.path.join(scriptDir,'..','..','libs','magick.exe')
magickPath = os.path.realpath(magickPath)
monitorScr = "screenshot:[{}]".format(monitor)

i = 0

while i < int(screens) :
Expand All @@ -22,11 +22,11 @@ def main(script,monitor,screens,interval,outName,incTime,incDate,outDir,myFormat
if incTime != "false":
currentTime = time.strftime("%H_%M_%S", time.gmtime())
currentName.append("-{}".format(currentTime))
print currentTime
print (currentTime)
if incDate != "false":
currentDate = time.strftime("%Y_%m_%d", time.gmtime())
currentName.append("-{}".format(currentDate))
print currentDate
print (currentDate)

#finalizing file name construction
currentName.append(".{}".format(myFormat))
Expand All @@ -35,21 +35,21 @@ def main(script,monitor,screens,interval,outName,incTime,incDate,outDir,myFormat


args.extend([outputScr])
print args
print (args)
subprocess.Popen(args)
#incrementing the number of repetitions
i = i + 1
#sleep and till the next interval
time.sleep(float(interval))






if __name__ == '__main__':

print sys.argv
print (sys.argv)
main(*sys.argv)
"""
try:
Expand All @@ -62,4 +62,4 @@ def main(script,monitor,screens,interval,outName,incTime,incDate,outDir,myFormat
print traceback.format_exc()
print "Press Enter to continue ..."
raw_input("Press ENTER to exit")
"""
"""
12 changes: 8 additions & 4 deletions src/menu/scripts/searchAndReplace/exec.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#python 3.6

import os
import sys

def main(script,mySel,mySearch,myReplace) :
print (mySel,mySearch,myReplace)
mySel = open(mySel,"r")
Expand All @@ -9,11 +14,10 @@ def main(script,mySel,mySearch,myReplace) :
newBasename = myBaseName.replace(mySearch, myReplace)
newFileName = os.path.join(myDirname,newBasename)
os.rename(fileName,newFileName)
print "{0} ===> {1}".format(myBaseName,newBasename)
print ("{0} ===> {1}".format(myBaseName,newBasename))



if __name__ == '__main__':
import os
import sys
main(*sys.argv)

main(*sys.argv)
12 changes: 6 additions & 6 deletions src/menu/scripts/sequenceToMp4/exec.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def convertSelected(ffmpegExec,inputPattern,outputPattern,frameRate,scale,crf,trc,startFrame,totalFrames,myAudio) :
print "converting Selected only..."
print ("converting Selected only...")
args = []
if ffmpegExec != 'None':
args.extend([ffmpegExec])
Expand Down Expand Up @@ -31,12 +31,12 @@ def convertSelected(ffmpegExec,inputPattern,outputPattern,frameRate,scale,crf,tr
args.extend(['-start_number',startFrame])

if totalFrames != 'None':
print totalFrames
print (totalFrames)
args.extend(['-vframes {}'.format(11)])

args.extend(['-vcodec','libx264','-pix_fmt','yuv420p',outputPattern])

print args
print (args)
#execute the args
subprocess.Popen(args)

Expand Down Expand Up @@ -90,10 +90,10 @@ def main(script,myDir,mySel,ffmpegExec,frameRate,scale,trc,crf,myAudio,outDir) :
#switch extention to mp4 for out put pattern
if outDir == 'None':
outputPattern = p.search(imageList[0]).group(1) + '.mp4'
print outputPattern
print (outputPattern)
else :
outputPattern = outDir + '\\' + os.path.basename(p.search(imageList[0]).group(1) + '.mp4')
print outputPattern
print (outputPattern)
convertSequence(ffmpegExec,inputPattern,outputPattern,frameRate,scale,crf,trc,myAudio)

"""
Expand Down Expand Up @@ -126,4 +126,4 @@ def main(script,myDir,mySel,ffmpegExec,frameRate,scale,trc,crf,myAudio,outDir) :
print >> sys.stderr, traceback.print_exc()
print "Press Enter to continue ..."
raw_input("Press ENTER to exit")
"""
"""
7 changes: 3 additions & 4 deletions src/menu/scripts/solidColor/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main(script, myDir, mySel, magickExec, myColor,selectedSize, size, fileForma
outRender = os.path.join(myDir, outFile)
args.extend([outRender])

print args
print (args)
# execute the args
subprocess.Popen(args)

Expand All @@ -61,9 +61,9 @@ def main(script, myDir, mySel, magickExec, myColor,selectedSize, size, fileForma
import os
import sys
import re
print sys.argv
print (sys.argv)
main(*sys.argv)

"""
try:
main(*sys.argv)
Expand All @@ -76,4 +76,3 @@ def main(script, myDir, mySel, magickExec, myColor,selectedSize, size, fileForma
print "Press Enter to continue ..."
raw_input("Press ENTER to exit")
"""

0 comments on commit 344befd

Please sign in to comment.