<?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 some python modules in script cause problem when publishing to arcgis server in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422070#M33169</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure to understand your answer. I am using python 2.7 only, on server and on desktop, not python3.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jul 2016 14:07:49 GMT</pubDate>
    <dc:creator>MaximeDemers</dc:creator>
    <dc:date>2016-07-21T14:07:49Z</dc:date>
    <item>
      <title>Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422068#M33167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My organization just been equiped with ArcMap and ArcGIS Server and I already encountered problem when trying to publish python script as geoprocessing services when some python modules are imported&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Those problematic python modules I have encoutered so far are &lt;STRONG&gt;urllib2&lt;/STRONG&gt; and &lt;STRONG&gt;uuid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import urllib2&lt;/STRONG&gt; or&lt;STRONG&gt; import uuid&lt;/STRONG&gt; , your script cannot published on the server, the publishing tool go idle and you have to kill the process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, if you do &lt;STRONG&gt;from urllib2 import *&lt;/STRONG&gt; or &lt;STRONG&gt;from uuid import *&lt;/STRONG&gt; , your script can be published.&lt;/P&gt;&lt;P&gt;This workaround can be problematic if classes or method in two modules have the same name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a problem ESRI is aware of? Why those particular modules are causing this error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 12:57:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422068#M33167</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2016-07-20T12:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422069#M33168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There were changes to urllib2 which may account for the behaviour&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/2/library/urllib2.html" title="https://docs.python.org/2/library/urllib2.html"&gt;20.6. urllib2 — extensible library for opening URLs — Python 2.7.12 documentation&lt;/A&gt; &lt;/P&gt;&lt;P&gt;from 2to3 &lt;/P&gt;&lt;P&gt;&lt;CODE class="descname" style="padding: 0 1px; font-size: 19px; font-family: monospace, sans-serif; font-weight: bold;"&gt;urllib&lt;/CODE&gt;&lt;A class="headerlink" href="https://docs.python.org/3.4/library/2to3.html?highlight=urllib2#2to3fixer-urllib" style="color: #6363bb; font-size: 0.8em; padding: 0 4px;" title="Permalink to this definition"&gt;https://docs.python.org/3.4/library/2to3.html?highlight=urllib2#2to3fixer-urllib&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Handles the rename of &lt;A class="reference internal" href="https://docs.python.org/3.4/library/urllib.html#module-urllib" style="color: #6363bb;" title="urllib"&gt;&lt;CODE class="py docutils xref py-mod literal" style="padding: 0 1px; font-size: 15px; font-family: monospace, sans-serif;"&gt;&lt;SPAN class="pre"&gt;urllib&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/A&gt; and &lt;CODE class="py docutils xref py-mod literal" style="padding: 0 1px; font-size: 15px; font-family: monospace, sans-serif;"&gt;&lt;SPAN class="pre"&gt;&lt;SPAN class="highlighted" style="background-color: #fbe54e;"&gt;urllib2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt; to the &lt;A class="reference internal" href="https://docs.python.org/3.4/library/urllib.html#module-urllib" style="color: #6363bb;" title="urllib"&gt;&lt;CODE class="py docutils xref py-mod literal" style="padding: 0 1px; font-size: 15px; font-family: monospace, sans-serif;"&gt;&lt;SPAN class="pre"&gt;urllib&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/A&gt; package.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/3.4/library/urllib.html#module-urllib" title="https://docs.python.org/3.4/library/urllib.html#module-urllib"&gt;21.5. urllib — URL handling modules — Python 3.4.5 documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perhaps it is future-proofing like the examples here that work in python 2 and 3&lt;/P&gt;&lt;P&gt;&lt;A href="http://python-future.org/quickstart.html" title="http://python-future.org/quickstart.html"&gt;Quick-start guide — Python-Future documentation&lt;/A&gt; &lt;/P&gt;&lt;P&gt;and there is even a pypi package that was used for those that need this&lt;/P&gt;&lt;P&gt;&lt;A href="https://pypi.python.org/pypi/future" title="https://pypi.python.org/pypi/future"&gt;future 0.15.2 : Python Package Index&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like a wise compromise to ensure 2 and 3 functionality&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 21:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422069#M33168</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-20T21:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422070#M33169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure to understand your answer. I am using python 2.7 only, on server and on desktop, not python3.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 14:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422070#M33169</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2016-07-21T14:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422071#M33170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;read the docs, they have future proofed the 2.7 version, the way you don't want to import urllib2 is now the accepted method since its previous incarnate has been split up.&amp;nbsp; It is not an onerous change and you will be ready when you need to migrate to 3.x.&lt;/P&gt;&lt;P&gt;Oh, it is also possible that just because you are running 2.7 it doesn't mean that something else up the software ladder may be running a higher version, but I don't know your network setup.&amp;nbsp; It is better to error on the side of caution&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 14:11:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422071#M33170</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-21T14:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422072#M33171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I get it. It's true that it's not an onerous change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if the reason why arcgis is modifiying the script and the way modules are imported during the publish process is to ensure that if the script was made with python3 (arcgis pro), it will be compatible with python2.7 installed on arcgis server?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have opened a python console on the server and doing import urllib2 is working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 14:55:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422072#M33171</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2016-07-21T14:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422073#M33172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a side note on importing custom modules (which is not the case for you):&lt;/P&gt;&lt;P&gt;&lt;A href="http://server.arcgis.com/en/server/latest/publish-services/windows/authoring-geoprocessing-tasks-with-python-scripts.htm#ESRI_SECTION1_87AFC11351574AD1A085A2528D946D3A" title="http://server.arcgis.com/en/server/latest/publish-services/windows/authoring-geoprocessing-tasks-with-python-scripts.htm#ESRI_SECTION1_87AFC11351574AD1A085A2528D946D3A"&gt;Authoring geoprocessing tasks with Python scripts—Documentation | ArcGIS for Server&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, may be interesting when in the future you are going to use imports of you own modules in scripts published to the server. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 15:21:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422073#M33172</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-07-21T15:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Importing some python modules in script cause problem when publishing to arcgis server</title>
      <link>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422074#M33173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After a long idle time (several hours), the Publisher returns the following errors:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; High&amp;nbsp;&amp;nbsp;&amp;nbsp; Unresolved&amp;nbsp;&amp;nbsp;&amp;nbsp; 00178&amp;nbsp;&amp;nbsp;&amp;nbsp; Data: C:\Windows\bfsvc.exe, used by Script Script cannot be copied to the server&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2016 12:49:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/importing-some-python-modules-in-script-cause/m-p/422074#M33173</guid>
      <dc:creator>MaximeDemers</dc:creator>
      <dc:date>2016-07-28T12:49:36Z</dc:date>
    </item>
  </channel>
</rss>

