Geographic Information Systems Asked by user160149 on April 3, 2021
I defined a custom toolbox in ArcMap 10.6, the script ran perfectly when I first use it, but ran in error when I use the same script with same parameters again. After I restart ArcMap 10.6, I can use it perfectly again.
When I use the same script in ArcGIS Pro,it run perfectly. I want to know if it is a bug? If so, is it a ArcMap’s bug or a networkx package’s bug or others? And what can I do?
Here is the error message:
File "******caculate_network.py", line 7, in <module>
import networkx as nx
File "C:Python27ArcGIS10.6libsite-packagesnetworkx__init__.py", line 128, in <module>
import networkx.drawing
File "C:Python27ArcGIS10.6libsite-packagesnetworkxdrawing__init__.py", line 6, in <module>
from . import nx_pydot
File "C:Python27ArcGIS10.6libsite-packagesnetworkxdrawingnx_pydot.py", line 27, in <module>
from pkg_resources import parse_version
File "C:Python27ArcGIS10.6libsite-packagespkg_resources__init__.py", line 48, in <module>
from pkg_resources.extern import six
File "C:Python27ArcGIS10.6libsite-packagespkg_resourcesextern__init__.py", line 45, in load_module
mod = sys.modules[extant]
AttributeError: 'NoneType' object has no attribute 'modules'
I have found a stupid workaround that worked in my case.
I could succesfully run my Python script importing tablib, but only the first run was successful. Until I have tried to import this library in Python window first before running the script. All successive script runs were without any error. Although I do not believe that it is relevant here are the specs:
ArcGIS 10.5.1 v. 7333 (no patches applied), Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32, tablib version 0.14.0
And the code that have triggered this error
import sys, arcpy, os
import tablib
and the error
Traceback (most recent call last):
File "D:DataTestTestTabLib.py", line 9, in <module>
import tablib
File "C:Python27ArcGIS10.5libsite-packagestablib__init__.py", line 2, in <module>
from pkg_resources import get_distribution, DistributionNotFound
File "C:Python27ArcGIS10.5libsite-packagespkg_resources__init__.py", line 48, in <module>
from pkg_resources.extern import six
File "C:Python27ArcGIS10.5libsite-packagespkg_resourcesextern__init__.py", line 44, in load_module
mod = sys.modules[extant]
AttributeError: 'NoneType' object has no attribute 'modules'
Answered by Damijan on April 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP