# Script runs perfect in Workspace but does not work in the Dynamo Player

**URL:** <https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700>\
**Category:** Revit\
**Tags:** revit, dynamo, navisworks\
**Created:** [January 15, 2019, 11:09am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700 "2019-01-15T11:09:45Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![JessWill](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jesswill/32/64550_2.png) [@JessWill](https://forum.dynamobim.com/u/JessWill)\
**Post date:** [January 15, 2019, 11:09am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/1 "2019-01-15T11:09:45Z")

</div>

Hi all,

I have made a script that exports a specific view to Navis in a certain location with a certain name as you can see below.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/1/8176c19b82011fdcc6adfe3fe094ee7d0061301b.png)

I have used ForceChildrensEval node but I believe that this is used only for running straight from the Workspace and on the second run. Sometimes the script works also if I connect the FilePath.DirectoryName straight to the Directory path but I have the same issues when running it from the player. Any idea what is causing this issue and what is the difference between running a script from the Workspace and player ?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/4/9495b41f76a5e8126199cb4d9a3a79c170291ce9.png)

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [January 16, 2019, 8:01am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/2 "2019-01-16T08:01:32Z")

</div>

why did you use the node FilePath.Directoryname twice ؟

---

<div class="post-metadata">

**Author:** ![JessWill](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jesswill/32/64550_2.png) [@JessWill](https://forum.dynamobim.com/u/JessWill)\
**Post date:** [January 16, 2019, 9:40am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/3 "2019-01-16T09:40:09Z")

</div>

It was late in the night and I was tired 🙂 Changed it afterwards but still not working.

Thanks,

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [January 16, 2019, 9:58am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/4 "2019-01-16T09:58:58Z")

</div>

can you run the script and show to us every node output ?

---

<div class="post-metadata">

**Author:** ![JessWill](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jesswill/32/64550_2.png) [@JessWill](https://forum.dynamobim.com/u/JessWill)\
**Post date:** [January 16, 2019, 10:38am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/5 "2019-01-16T10:38:25Z")

</div>

Sure can please see below screenshot,

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/1/d1f1dfe4a7b7c2fedbfb42e1d26d488f3ac3f9ad.png)

For some strange reason the script work after pressing the Run button for the second time. I can share also the script itself it makes any difference. ( To get that 3D view I have another script in the Playlist that generates it )

Thanks,

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [January 16, 2019, 11:52am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/6 "2019-01-16T11:52:02Z")

</div>

for FilePath.FileName, the input for withExtension is bool not string, and it should be false in your case.  
but i believe it is not the reason.  
have you check if it is a permission issue ?  
share it if you have no problem

---

<div class="post-metadata">

**Author:** ![JessWill](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jesswill/32/64550_2.png) [@JessWill](https://forum.dynamobim.com/u/JessWill)\
**Post date:** [January 16, 2019, 11:59am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/7 "2019-01-16T11:59:48Z")

</div>

Thanks for the help Khuzaimah,

Just so you know, I am trying to automate the model federation process process with a dynamo scrip. I am using it to generate a 3d View, set my view parameters, clean annotations, remove imported dwgs and at the end export the view to nwc format to federate it in Navisworks from where I can later export it to Revizto. Seems to work alright until the point of the Export which sometimes works and sometimes doesn’t. Any idea on what I am doing wrong ? I have added screenshots of the script and also the script if it help.

[Full dynamo script.dyn](https://forum.dynamobim.com/uploads/short-url/u5QP0eodYvbI1ZLkrxvlxkU6S7Y.dyn) (29.4 KB)

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [January 16, 2019, 12:47pm UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/8 "2019-01-16T12:47:27Z")

</div>

that is weird, the same is for me, the script works after second run,  
@Mostafa_El_Ayoubi , this node from your package if you please can help in this.

---

<div class="post-metadata">

**Author:** ![maltheshkathare](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@maltheshkathare](https://forum.dynamobim.com/u/maltheshkathare)\
**Post date:** [January 16, 2019, 1:03pm UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/9 "2019-01-16T13:03:54Z")

</div>

That might be because in the first run it is not finding the view. In the 2nd run because the view is created in first run and able to find it. Try changing the view node to string and get view by name or similar node.

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [January 16, 2019, 1:18pm UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/10 "2019-01-16T13:18:16Z")

</div>

i have thinking about that, and i tried to choose a view already created but it is the same reasult

---

<div class="post-metadata">

**Author:** ![JessWill](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jesswill/32/64550_2.png) [@JessWill](https://forum.dynamobim.com/u/JessWill)\
**Post date:** [January 16, 2019, 4:23pm UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/11 "2019-01-16T16:23:46Z")

</div>

Thanks for trying 🙂

---

<div class="post-metadata">

**Author:** ![evelhalo](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@evelhalo](https://forum.dynamobim.com/u/evelhalo)\
**Post date:** [April 10, 2020, 8:23pm UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/12 "2020-04-10T20:23:28Z")

</div>

Sorry little late to the party, don’t know if you had any success, it’s been a while but I had this same problem creating a data export and then utilizing the result. I had to split my script to get the data from Revit and a second script to ship the data out. we ended up just runing them sequentially in player. There is also a “pause” node (i think springs package). Might be worth a shot to see if you can stall the process as Revit creates or exports the view.

---

<div class="post-metadata">

**Author:** ![bschneiderhan](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@bschneiderhan](https://forum.dynamobim.com/u/bschneiderhan)\
**Post date:** [July 3, 2020, 6:42pm UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/13 "2020-07-03T18:42:30Z")

</div>

I had a similar issue exporting to navisworks and I was able to have success utilizing a transaction start/end node before the export node. I’m not sure how it causes it to work but it allows for player to actually export views.

---

<div class="post-metadata">

**Author:** ![IKK](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@IKK](https://forum.dynamobim.com/u/IKK)\
**Post date:** [June 3, 2022, 10:44am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/14 "2022-06-03T10:44:54Z")

</div>

Hello everyone,

unfortunately I have the same issue. I would like to know if this topic was resolved somehow?  
Do you know what can cause this behavior?

@JessWill how did you work it out?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [June 3, 2022, 10:48am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/15 "2022-06-03T10:48:02Z")

</div>

@IKK , hi

Which Dynamo and Revit Version do you use…? Is a a college running the script?

Are the packages correct?

---

<div class="post-metadata">

**Author:** ![IKK](https://avatars.discourse-cdn.com/v4/letter/i/9d8465/32.png) [@IKK](https://forum.dynamobim.com/u/IKK)\
**Post date:** [June 3, 2022, 11:14am UTC](https://forum.dynamobim.com/t/script-runs-perfect-in-workspace-but-does-not-work-in-the-dynamo-player/30700/16 "2022-06-03T11:14:04Z")

</div>

Hello,

thank you for your reply.  
We are using Revit 2021.1.3 and Dynamo 2.6.1  
Packages are correct and we have the same situation on several PC.
