<?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: &amp;quot;No module named os&amp;quot; when running Python Script in ArcGIS in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19721#M704</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had the same error while doing the on line tutorial Basics of Python (for ArcGIS 10).&amp;nbsp; I typed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hit enter and got &amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then was able to call import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;May have to do: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 May 2012 04:05:27 GMT</pubDate>
    <dc:creator>JamesSkurupey</dc:creator>
    <dc:date>2012-05-10T04:05:27Z</dc:date>
    <item>
      <title>&amp;quot;No module named os&amp;quot; when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19710#M693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing this to possibly help others who may come across this message when running in the ArcGIS Geoprocessor. Here is a test script to illustrate the issue related to importing the OS Module into a script running in ArcGIS (i.e., the script runs with no problem in PythonWin):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "\n- - - - - - - - - - - - - - - - - - S T A R T - - - - - - - - - - - - - - - - - - - -\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import modules and create the geoprocessor object (gp)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, os, arcgisscripting as ARC&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = ARC.create(9.3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "\n- - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - -\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;PythonWIN Results&lt;/STRONG&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- - - - - - - - - - - - - - - - - - S T A R T - - - - - - - - - - - - - - - - - - - -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Geoprocessor Results&lt;/STRONG&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Start Time: Wed Sep 15 16:21:21 2010&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Running script testOS...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;type 'exceptions.ImportError'&amp;gt;: No module named os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (testOS).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Time: Wed Sep 15 16:21:22 2010 (Elapsed Time: 1.00 seconds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;SOLUTION&lt;/STRONG&gt;&lt;SPAN&gt;: The ntpath.pyc module, necessary for importing the os module, is not in the C:\Program Files\ArcGIS\bin path. To resolve this, if it happens to you, set the PYTHONPATH Environment variable to include the path to the same directory where PythonWin finds the ntuser.pyc module. You can determine this easily by going to the Interactive Window in PythonWin or IDLE and typing: import os; os.path. It will typically be in the following directory C:\Python25\Lib or something like that. Include that path as a value in your PYTHONPATH Environment variable (separate paths with semicolons) and see if this test script will run as a Script Tool in the ArcGIS Toolbox. It should work. It did for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Apparently, when running in PythonWin, the loader searches in the same directory where the python.exe is found and doesn't use (need) PYTHONPATH to resolve the reference. When running under the python.exe in the C:\Program Files\ArcGIS\bin it does need PYTHONPATH to resolve the reference. On the other hand, when running in PythonWin, the loader does use the PYTHONPATH Environment variable to resolve the arcgisscripting reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Robert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 19:49:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19710#M693</guid>
      <dc:creator>RobertWall</dc:creator>
      <dc:date>2010-09-21T19:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19711#M694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You must have a strange installation. The os module works for me without any hacking.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My pythonpath is set to C:\arcgis\bin (which I am not all that comfortable with) but I don't seem to need to set it to c:\python25\lib as well to work as a script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The os module behaves at 10 for me as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Sep 2010 10:15:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19711#M694</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2010-09-27T10:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19712#M695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had the same problem with ArcGIS 10 SP1 (Win 7 64-bit).&amp;nbsp; I'm also think that installing PythonWin messes something up with ArcGIS Desktop.&amp;nbsp; I just had to create a environmental variable called "PYTHONPATH" and set it to "C:\Python26\ArcGIS10.0\Lib".&amp;nbsp; That fixed the issue.&amp;nbsp; Thanks Robert for the solution!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 00:12:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19712#M695</guid>
      <dc:creator>IanKramer</dc:creator>
      <dc:date>2011-02-14T00:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19713#M696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The strange location of Python doubly installed by ArcGIS must have something to do with it. I don't like having a second copy of Python that Esri installs, sure to end in tears! I delete the copy and leave or put Python in the conventional location. (I keep the Desktop10.pth file and the numpy folder from site-packages that Esri adds, uninstall Python and reinstall manually in the conventional location. Then I copy back the two saved settings.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:/Python25 or C:/Python26 is the Proper Place for Python IMHO. It is then very predictable for other installed packages and editors. Everything then works properly, especially Python Help files. There is no DOT in the path so that dirname and basename are easier to parse. Fixing that would be my wish for a service pack, but I doubt if it will happen because this was raised during the Beta testing. I didn't see any valid reason given to do it that way and have had nothing but trouble since with any installation configured like that if you are going to extend Python or do development.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 01:21:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19713#M696</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2011-02-14T01:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19714#M697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I too raised the issue during beta testing. The double installation really is painful, but I too have learned to live with it. Maybe something for ideas.arcgis.com...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 03:53:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19714#M697</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2011-02-14T03:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19715#M698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had an issue with this...&amp;nbsp; As it turned out, during the installation, Python somehow defaulted to being installed on my E: drive (an external I had at the time), but went unnoticed?!&amp;nbsp; That drive died a while back, but I didn't realize that Python was pointing there.&amp;nbsp; I've been having issues with certain tools in ArcToolbox, but didn't put the two together until finally getting around to troubleshooting it now and seeing the post above.&amp;nbsp; Double-checking my IDLE shortcut path, I saw the reference to E:.&amp;nbsp; Having recovered my deceased drive's contents which were restored to another volume, I simply copied the Python25 directory to C: (where it should've been anyway), added the path to my environmental variable, rebooted, and all is well.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the above info!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 19:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19715#M698</guid>
      <dc:creator>GavinMcDade</dc:creator>
      <dc:date>2011-04-20T19:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19716#M699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Robert! I have been beating my head against the wall on this one and your suggestion worked.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jun 2011 14:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19716#M699</guid>
      <dc:creator>ChristopherEbright</dc:creator>
      <dc:date>2011-06-29T14:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19717#M700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, all&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still have no idea how to make import os work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is there any pro. can give clear instruction step by step, please?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By following Robert's instruction, I can find the os.path. Question is: how to include path as a value in PYTHONPATH Environment variable (separate paths with semicolons) ????&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Dec 2011 18:10:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19717#M700</guid>
      <dc:creator>zhengniu</dc:creator>
      <dc:date>2011-12-13T18:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19718#M701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This fault happens after installing a service pack for ArcGIS. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no need to set the PYTHONPATH variable&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Save the numpy folder in c:\python26\Desktop10.0\Lib\site-packages, or reinstall it again later.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; save the file from c:\python26\Desktop10.0\Lib\site-packages\Desktop10.pth&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Remove Python and re-install python 2.6.6 in the standard location c:\python26&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Reinstall Pythonwin with pywin32-216.win32-py2.6.exe &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Copy the path file remaining that points to the arcpy module:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;STRONG&gt;c:\python26\Desktop10.0\Lib\site-packages\Desktop10.pth&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;c:\python26\Lib\site-packages\Desktop10.pth&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Reinstall numpy or move the numpy folder to &lt;/SPAN&gt;&lt;STRONG&gt;c:\python26\Desktop10.0\Lib\site-packages&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;6. You can then delete the directory c:\python26\Desktop10.0 completely so that you only have one installation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Test to see if Pythonwin opens with the correct version. Try opening the Python Help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Test a script tool from ArcGIS using the os module.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe this will be fixed at 10.1?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2011 07:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19718#M701</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2011-12-14T07:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19719#M702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had the same issue with ArcGIS 10, and I have separate installation of python from activestate which I want to keep.&amp;nbsp; I have work around which goes like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Create a script called "fixpath.py" like follows &lt;/LI&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import sys
sys.path.extend(
"""C:\Python26_esri\ArcGIS10.0\Lib\idlelib
C:\Python26_esri\ArcGIS10.0\DLLs
C:\Python26_esri\ArcGIS10.0\lib
C:\Python26_esri\ArcGIS10.0\lib\plat-win
C:\Python26_esri\ArcGIS10.0\lib\lib-tk
C:\Python26_esri\ArcGIS10.0
C:\Python26_esri\ArcGIS10.0\lib\site-packages""".split())
&lt;/PRE&gt;&lt;BR /&gt;&lt;LI&gt;Copy or save the file above as C:\Program Files\ArcGIS\Desktop10.0\arcpy\fixpath.py&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Do whichever that applies&lt;/LI&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Script&lt;/LI&gt;&lt;BR /&gt;When you run your script, have following line, before doing anything.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import fixpath&lt;/PRE&gt;&lt;BR /&gt;&lt;LI&gt;Python prompt from arcmap&lt;/LI&gt;&lt;BR /&gt;type "import fixpath"&lt;BR /&gt;&lt;/OL&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;I came to this fix observing that&lt;/SPAN&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;ArcMap's prompt still can find "sys"&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;By comparing sys.path output between Pythonwin (which I started from ArcGIS' program shortcut group) and Arcmap's python prompt, I noticed that all of those python directories are dropped somehow.&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;SPAN&gt;So I guess you can do similar by comparing sys.path of pythonwin and arcmap's python prompt, provided that they are using same python executable but the path got somehow screwed in arcmap.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Caveats:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Note that I specified to install python to c:\python26_esri when i installed arcgis, as I was using python2.6 at the time and i didn't want to overwrite it.&amp;nbsp; So match with yours, which is c:\python26 by default&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;I observed entire arcmap drops dead when the script i added had error.&amp;nbsp; it happeded when I go into python command prompt.&amp;nbsp; I guess the prompt tries to see what names are available in python and then if it throws exception arcmap cannot handle it.&amp;nbsp; once i got script to fix (i forgot to import sys), the problem was gone.&amp;nbsp;&amp;nbsp; So moral is to plan for to get out (which is to remove fixpath.py&amp;nbsp; and all reference to it from your scripts)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:47:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19719#M702</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2021-12-10T20:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19720#M703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I used Robert's suggestions, in addition to reading through everyone's comments and have been able to clear up the original error ("No module named os") but now have a new error which reads: "&amp;lt;type 'exceptions.TypeError'&amp;gt;: cannot create weak reference to 'classobj' object" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based upon the above statements I added a System Environment Variable called PYTHONPATH pointed at C:\Python27\Lib. I determined this location by doing exactly what he said (Opened python in a command prompt, imported the os module and then typed os.path to find out where ntpath.pyc was located because that is needed for importing the os module). Now, when I try to import os, arcpy or others (except math because that is always available) I receive the error "Cannot create weak reference to 'classobj' object" Does anyone have any suggestions? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try some of the other suggestions here that require more system changes but I do not have administrative privileges on my computer so that can be difficult to do when it may not work. Please let me know any suggestions! Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 19:49:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19720#M703</guid>
      <dc:creator>LauraClemente</dc:creator>
      <dc:date>2012-02-08T19:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19721#M704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I had the same error while doing the on line tutorial Basics of Python (for ArcGIS 10).&amp;nbsp; I typed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hit enter and got &amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then was able to call import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;May have to do: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 04:05:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19721#M704</guid>
      <dc:creator>JamesSkurupey</dc:creator>
      <dc:date>2012-05-10T04:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19722#M705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The error message came back when I installed the patch for the overlay bug introduced in 10.0 SP 4. It took me a while to remember...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Delete C:\Python26\ArcGIS10.0 folder. (Empty except for a Desktop10.pth)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Start up the Python 2.6.6 installer python-2.6.6.exe and choose repair 2.6.6&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything now back to normal.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 08:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19722#M705</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2012-05-29T08:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19723#M706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-size:4;"&gt;&lt;STRONG&gt;In fact, arcgis surely can import these modules, like os, sys and some other python core and the third-part modules.&lt;BR /&gt;what you only need to do is import arcpy firstly, then import the other modules, though while importing the python core modules the autocompleting function not work.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Oct 2012 07:22:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19723#M706</guid>
      <dc:creator>nacui</dc:creator>
      <dc:date>2012-10-26T07:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19724#M707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am connecting to the map / gp services remotely over a network. I have completed the steps in post 1 on my local machine, and still get the same error as in post 1. Do the steps to fixpath need to be completed on server machine, even though the gp service is referencing the toolbox / python script in a network directory? Must the toolbox also reside on, and run from, the server machine instead?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 12:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19724#M707</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2013-04-04T12:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19725#M708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK, our issue was that ArcGISSOC did not have permissions to the Python directory on the server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 20:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19725#M708</guid>
      <dc:creator>BarryGuidry</dc:creator>
      <dc:date>2013-04-18T20:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19726#M709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Experienced this same issue when running the Batch Project tool on ArcGIS Desktop 10 with SP5.&amp;nbsp; I ran the Create File GDB tool and it went fine.&amp;nbsp; Found that odd.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The PYTHONPATH environment variable solved the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2013 13:28:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19726#M709</guid>
      <dc:creator>DerivenC</dc:creator>
      <dc:date>2013-05-03T13:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: "No module named os" when running Python Script in ArcGIS</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19727#M710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;easy,just add PATH as :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PATH=%PATH%:C:\Python26\ArcGIS10.0:C:\Python26\ArcGIS10.0\bin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 May 2013 08:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/amp-quot-no-module-named-os-amp-quot-when-running/m-p/19727#M710</guid>
      <dc:creator>dcxia</dc:creator>
      <dc:date>2013-05-08T08:51:20Z</dc:date>
    </item>
  </channel>
</rss>

