4 ms·
I had to use os.popen (Maya, MotionBuilder, and outside) (obsolete by now, but still available), and it seemed much more easier than subprocess.Popen because I
by malkia 15y ago
I had to use os.popen (Maya, MotionBuilder, and outside) (obsolete by now, but still available), and it seemed much more easier than subprocess.Popen because I simply wanted a file filter.
Basically a coworker had ways to read/write custom ASCII 3D animation and model format, and another one introduced a binary form for it. All I did was to replace his "open" function with "open_model" and "open_anim" (no monkey patching), with something like this:
def open_anim(name, mode, *args, **kwargs):
if name.upper().endswith( ".BIN_ANIM" ):
if 'r' in mode:
return os.popen( "anim_bin2text <" + name, mode, *args, **kwargs )
if 'w' in mode:
return os.popen( "anim_text2bin >" + name, mode, *args, **kwargs )
return open(name, mode, *args, **kwargs)
- VMG 15y agopopen might have been simple but don't forget popen2, popen3 and popen4, spawn, spawnvp, spawnlp. You've got to get rid of that cruft or you become php.