Script tool fails after first execution

11-03-2020 03:29 PM
Occasional Contributor III

Hi All, 

Got an odd one... I feel like I've come across something similar before but it's got me stumped right now.  

Quick Summary:

  • The script tool runs successfully outside of ArcMap/Catalog via python CLI
  • The script tool runs successfully the FIRST time run from the toolbox inside ArcMap/ArcCatalog
  • The script tool FAILS every time after the first until ArcMap/ArcCatalog is closed and restarted
  • The function in the script tool runs successfully if called multiple times from a second script tool during the same execution but then fails with the same pattern when run consecutively. 
  • The failure is a critical level exception exiting the script:

Traceback (most recent call last):
File "D:\support\arcgis\msal\", line 21, in <module>
result = get_token()
File "D:\support\arcgis\msal\", line 14, in get_token
File "C:\Python27\ArcGIS10.6\lib\site-packages\msal\", line 239, in __init__
self.http_client, validate_authority=validate_authority)
File "C:\Python27\ArcGIS10.6\lib\site-packages\msal\", line 85, in __init__
File "C:\Python27\ArcGIS10.6\lib\site-packages\msal\", line 142, in tenant_discovery
resp = http_client.get(tenant_discovery_endpoint, **kwargs)
File "C:\Python27\ArcGIS10.6\lib\site-packages\requests\", line 543, in get
return self.request('GET', url, **kwargs)
File "C:\Python27\ArcGIS10.6\lib\site-packages\requests\", line 516, in request
prep = self.prepare_request(req)
File "C:\Python27\ArcGIS10.6\lib\site-packages\requests\", line 455, in prepare_request
headers=merge_setting(request.headers, self.headers, dict_class=CaseInsensitiveDict),
File "C:\Python27\ArcGIS10.6\lib\site-packages\requests\", line 69, in merge_setting
merged_setting = dict_class(to_key_val_list(session_setting))
File "C:\Python27\ArcGIS10.6\lib\site-packages\requests\", line 46, in __init__
self.update(data, **kwargs)
File "C:\Python27\ArcGIS10.6\Lib\", line 564, in update
if isinstance(other, Mapping):
File "C:\Python27\ArcGIS10.6\Lib\", line 144, in __instancecheck__
return cls.__subclasscheck__(subtype)
File "C:\Python27\ArcGIS10.6\Lib\", line 180, in __subclasscheck__
if issubclass(subclass, scls):
File "C:\Python27\ArcGIS10.6\Lib\", line 180, in __subclasscheck__
if issubclass(subclass, scls):
File "C:\Python27\ArcGIS10.6\lib\site-packages\", line 1410, in __subclasscheck__
return super(GenericMeta, self).__subclasscheck__(cls)
TypeError: super() argument 1 must be type, not None


The script tool integrates data between a feature class and an external API behind an AzureAD authentication. 

I've installed the official Microsoft library

c:\Python27\ArcGIS10.6\Scripts\pip.exe install msal

The failure is not in the actual call for an authorization token but simply in the init constructor of the 'AD App' class so I'm able to strip it down to a very basic example which is attached in the zip file:

1. - script file with function that initializes the 'AD App' and returns a true/false if the app class is created

2. - script file that calls the 'create app' function inside twice in a row 

   This was an attempt to see if it's something with multiple instances of the app class being created or if it's something specific with how ArcMap/Catalog are running the script itself.... appears to be the latter

3. toolbox.tbx - toolbox with both scripts attached as tools

To repo:

1. install msal (see above) 

2. CLI tests (execution is successful, no exceptions throw, simple text output returned)



3. Open ArcCatalog

   Browse to toolbox

   Execute DoAuth tool - success, close window

   Execute DoAuth tool - fail 

   Close ArcCatalog 



Any thoughts? 

Thanks in advance 

Tags (1)
0 Kudos
1 Reply
New Contributor

Hi Fred,

i am also getting similar error, did you find any workaround for this?


0 Kudos