title: Unhandled Exception with IronPython
body: <p>I just installed Iron Python.  When I open it up in terminal it shows installed.  When I look for the .dll in Visual Studio I can find them an add them to the project.  I was following along a tutorial on microsoft site.  Everything was going fine until I got to the very end with...</p>
  
  <blockquote>
    <p>Save the file and press CTRL+F5 to build and run the application.</p>
  </blockquote>
  
  <p>Which is when I got the error.</p>
  
  <blockquote>
    <p>Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program >Files (x86)\IronPython 2.7.9 for .NET 4.0\Lib'.
      at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
      at System.IO.Directory.SetCurrentDirectory(String path)
      at DynamicIronPythonSample.Program.Main() in >C:\Users\scott\source\repos\DynamicIronPythonSample\Program.cs:line 17</p>
  </blockquote>
  
  <p>This is what I am referencing
  <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/walkthrough-creating-and-using-dynamic-objects" rel="nofollow noreferrer">Walkthrough: Creating and Using Dynamic Objects (C# and Visual Basic)</a></p>
  
  <p>How can I fix this issue?
  Line 17 is this line in Program.cs</p>
  
  <pre><code>            System.IO.Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\IronPython 2.7.9 for .NET 4.0\Lib");
  </code></pre>
  
  <p>Entire script</p>
  
  <pre><code>using Microsoft.Scripting.Hosting;
  using IronPython.Hosting;
  using System;
  using System.Linq;
  
  namespace DynamicIronPythonSample
  {
      class Program
      {
          static void Main()
          {
              // Set the current directory to the IronPython libraries.
              System.IO.Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\IronPython 2.7.9 for .NET 4.0\Lib");
  
              // Create an instance of the random.py IronPython library.
              Console.WriteLine("Loading random.py");
              ScriptRuntime py = Python.CreateRuntime();
              dynamic random = py.UseFile("random.py");
              Console.WriteLine("random.py loaded.");
  
              //  Initialize an enumerable set of integers
              int[] items = Enumerable.Range(1, 7).ToArray();
  
              //  Randomly shuffle the array of integers by using IronPython.
              for (int i = 0; i &lt; 5; i++)
              {
                  random.shuffle(items);
  
                  foreach (int item in items)
                  {
                      Console.WriteLine(item);
                  }
                  Console.WriteLine("-------------------");
              }
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>IronPython 2.7.9 (2.7.9.0) on .NET 4.0.30319.42000 (64-bit)
    Type "help", "copyright", "credits" or "license" for more information.</p>
    
    <p>.NET v4.0.30319</p>
  </blockquote>