<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Importing Scripts in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134498#M1810</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;glad you found a solution !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers !&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Jun 2013 18:46:41 GMT</pubDate>
    <dc:creator>MatthiasBuehler1</dc:creator>
    <dc:date>2013-06-12T18:46:41Z</dc:date>
    <item>
      <title>Importing Scripts</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134496#M1808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I have a number of scripts in the Workspace "scripts" folder, using the sys.path.append() method I am oftem but seeminlgy randomly getting errors when trying to run scripts that import scripts in the same directory:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
from scripting import *
# get a CityEngine instance
ce = CE()

sys.path.append( ce.toFSPath("scripts/") )
import myModule&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sometimes it works fine, but often I get an error and the scripts refuses to run:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;...&amp;gt;\CityEngine_TestProject01\scripts\&amp;lt;script&amp;gt;.py", line 17, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.path.append(ce.toFSPath("scripts/"))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NameError: name 'sys' is not defined&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... which is odd as "sys" ought to always be available and it periodically works and then doesnt work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After reloading CityEngine and trying a script it appears that some scripts work and some dont but it always seems to be random as to which ones will succeed and which wont.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 09:30:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134496#M1808</guid>
      <dc:creator>HD1</dc:creator>
      <dc:date>2013-06-06T09:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Scripts</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134497#M1809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":neutral_face:"&gt;😐&lt;/span&gt; appears that one of the imported scripts wasnt importing "sys".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fixed by adding "import sys" to the scripts ( the Python console does this automatically but the auto-generated *.py scripts do not, thet only import "scripting" )&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 14:58:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134497#M1809</guid>
      <dc:creator>HD1</dc:creator>
      <dc:date>2013-06-10T14:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Scripts</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134498#M1810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;glad you found a solution !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers !&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 18:46:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/importing-scripts/m-p/134498#M1810</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2013-06-12T18:46:41Z</dc:date>
    </item>
  </channel>
</rss>

