Jump to content
Sign in to follow this  
mohamaedkamal

houdini python and mply

Recommended Posts

hi everyone , I want  to open seqence of cache bgeo files using mplay , anyone can find the way of doing this using houdini and python

Share this post


Link to post
Share on other sites
import subprocess
subprocess.Popen(['gplay', '/path/to/your/geometry.$F4.bgeo'])

 

gplay must be in PATH, otherwise, specify a full path to it ($HFS/bin/gplay)

  • Like 1

Share this post


Link to post
Share on other sites

 

3 hours ago, Stalkerx777 said:

import subprocess
subprocess.Popen(['gplay', '/path/to/your/geometry.$F4.bgeo'])

 

gplay must be in PATH, otherwise, specify a full path to it ($HFS/bin/gplay)

thank u 

Share this post


Link to post
Share on other sites

hi guys,

is there any reason why this would not be working. i could have scripted it wrong.

 

I'm in hou 18.

 

I cant seem to get it to work with $F4 in the file path. throws an error.

 

can get it to work with single files.

 

anyone got any ideas?

Share this post


Link to post
Share on other sites

$F4 is probably getting evaluated and will return a single frame number
try replacing $F4 with *

Share this post


Link to post
Share on other sites

Hi Bunker,

thanks for the help.

Nope, I am afraid that didn't seem to work.

 

my evaluated end of the string looked like this when I replace $F4.

/geometry/moreframes/box.*.bgeo

 

Googling this I can't seem to find any info on this problem.

 

when picking files manually I noticed it had the frame range in () at the end of the string.

 

like (1-240)

 

but i tried this also adding to the end of the string. but it didnt work. unless it needs to be in a tuple or something.

 

cheers

 

Daniel

 

 

Share this post


Link to post
Share on other sites
import subprocess
command='gplay /tmp/tmp.*.bgeo.sc'
subprocess.Popen(command,shell=True)

This works for me. You'll need the full path on disk, not relative.

Share this post


Link to post
Share on other sites

Hi Again Bunker,

 

thanks so much for your help. im still clutching at straws here.

the function I'm building is basically being run off a right-click menu in a QT widget window. Don't know if that makes a difference.

this is the last part of my function for testing purposes.

filePath = filePath.replace("$F4", "*")

command = 'gplay ' + filePath

subprocess.Popen(command,shell=True)

this is the whats my command variable prints like

gplay C:\Users\Daniel\Documents\NodeShare\Geometry\moreframes\box.*.bgeo

and it's still throwing an error. and yeah I am importing subprocess its at the top of my function.

just get this error.

image.png.f7ce2cd7c203180c6d5c7182005f6b84.png

 

hou 18 - python 2.7

 

cheers

Daniel

Share this post


Link to post
Share on other sites

gplay doesn't accept wildcards in a filename. At a command line, "gplay *.bgeo" works because the shell is expanding *.bgeo to a list of valid filenames. You'll need to to the same.

Share this post


Link to post
Share on other sites

thanks for the heads up malexander. 

 

after a bit of tinkering, I did finally get it to work....

few things to look out for.

in your list of file paths

firstly you have to make sure each string for the file path has a space before.

then I ran into the problem where it would not open file paths that had a white space in the  whole path.

so after a bit of reading, I think because it's a shell operation? I have to have the string encapsulated in " " .

(please correct me if I am wrong on this)

 

so a simplified version below

import subprocess

fileSequenceList = [' "tmp/tmp/box.001.bgeo"', ' "tmp/tmp/box.002.bgeo"', ' "tmp/tmp/box.003.bgeo"']

subprocess.Popen(['gplay', fileSequenceList])

 

if I run into any other hurdles. il post them up.

 

cheers

 

Daniel

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×