Possibilty to run a mp3 / mp4 file when running a script

Hello everyone,

I was wondering if it is possible to run an mp3 / mp4 file when i run my script.
(Just for fun.) And if this is possible, how can i achieve this?

Regards,
Daan

1 Like

Have a look at this thread. :slight_smile:

Hello @Daan,

You can pretty easily use Dynamo to open up files using some simple Python :slight_smile:

import os

def playSomething(path):
    from os import startfile
    startfile(path)
    
OUT = playSomething(IN[0])

The graph is as simple as this!

I tested with a sample from here: https://file-examples.com/index.php/sample-video-files/sample-mp4-files/

6 Likes

Tried this on my side, I’m getting this error :

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named os

I’m using Revit 2020.1 and Dynamo 2.2.1 for this :slight_smile: What set-up do you have?

1 Like

Hi @Revit_Noob

Just add below few lines before import os, that will work in any version of revit and any version of dynamo.

import sys
path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(path)
2 Likes

noted. Thanks @Kulkul

Revit 2017 / Dynamo 1.3.4

1 Like