<?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: acitoolkit ImportError - cannot import 'Sequence' from 'collection in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904390#M3181</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;BR /&gt;Try to replace import * with the stuff you need in your script, for example:&lt;BR /&gt;instead of:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from acitoolkit.acitoolkit import *&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from acitoolkit.acitoolkit import Session
from acitoolkit.aciphysobject import Pod, Node, Link&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2023 06:17:09 GMT</pubDate>
    <dc:creator>Marcel Zehnder</dc:creator>
    <dc:date>2023-08-14T06:17:09Z</dc:date>
    <item>
      <title>acitoolkit ImportError - cannot import 'Sequence' from 'collections'</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904278#M3180</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I am having an ImportError issue using acitoolkit on Python.&lt;/P&gt;&lt;P&gt;I already installed the acitoolkit package with 'pip install acitoolkit' command from bash terminal within Pycharm (on Ubuntu Linux ssytem), but it is giving me an ImportError at the code below.&lt;/P&gt;&lt;P&gt;My code on Pycharm environment:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;acitoolkit.acitoolkit &lt;SPAN&gt;import &lt;/SPAN&gt;*        &lt;SPAN&gt;# This imports the acitoolkit module from the acitoolkit package&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;from acitoolkit.acitoolkit import * # This imports the acitoolkit module from the acitoolkit package&lt;BR /&gt;File "/usr/local/lib/python3.10/dist-packages/acitoolkit/__init__.py", line 35, in &amp;lt;module&amp;gt;&lt;BR /&gt;from .acitoolkit import ( # noqa&lt;BR /&gt;File "/usr/local/lib/python3.10/dist-packages/acitoolkit/acitoolkit.py", line 33, in &amp;lt;module&amp;gt;&lt;BR /&gt;from collections import Sequence&lt;BR /&gt;ImportError: cannot import name 'Sequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;I'd be glad if I can receive advice on how to rectify this.&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 22:44:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904278#M3180</guid>
      <dc:creator>EAG</dc:creator>
      <dc:date>2023-08-13T22:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: acitoolkit ImportError - cannot import 'Sequence' from 'collection</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904390#M3181</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;BR /&gt;Try to replace import * with the stuff you need in your script, for example:&lt;BR /&gt;instead of:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from acitoolkit.acitoolkit import *&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from acitoolkit.acitoolkit import Session
from acitoolkit.aciphysobject import Pod, Node, Link&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 06:17:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904390#M3181</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-08-14T06:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: acitoolkit ImportError - cannot import 'Sequence' from 'collection</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904607#M3182</link>
      <description>&lt;P&gt;Hi Marcel,&lt;/P&gt;&lt;P&gt;Tried that, still giving the same thing. Don't know why&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 14:25:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904607#M3182</guid>
      <dc:creator>EAG</dc:creator>
      <dc:date>2023-08-14T14:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: acitoolkit ImportError - cannot import 'Sequence' from 'collection</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904650#M3183</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1155515"&gt;@EAG&lt;/a&gt;&amp;nbsp;L&lt;SPAN&gt;ooks like the error message you are getting is because the Sequence class has been moved from the collections module to the typing module in Python 3.10.&amp;nbsp;The collections module still contains the Sequence class, but it is now deprecated in Python 3.10. The typing module is the preferred way to import the Sequence class in Python 3.10.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Try....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from acitoolkit.acitoolkit import *
from typing import Sequence&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 15:52:15 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4904650#M3183</guid>
      <dc:creator>bigevilbeard</dc:creator>
      <dc:date>2023-08-14T15:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: acitoolkit ImportError - cannot import 'Sequence' from 'collection</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4906741#M3184</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/352839"&gt;@bigevilbeard&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the suggestions,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yeah, but how do I find my way around the fact that the Sequence class, though deprecated is still within the collections s module? Your code still has the line 'from acktoolkit.acitoolkit import *' which is causing the import error. Putting it after the next import line still results on an error, as long as the collections module still contains the Sequece class. I even tried using exceptions to deal with this but then it jumped the entire import of the acitoolkit.acitoolkit module.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 00:32:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4906741#M3184</guid>
      <dc:creator>EAG</dc:creator>
      <dc:date>2023-08-17T00:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: acitoolkit ImportError - cannot import 'Sequence' from 'collection</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4906932#M3185</link>
      <description>&lt;P&gt;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1155515"&gt;@EAG&lt;/a&gt;&amp;nbsp;i think its the python version you are using, is 3.10 supported with ACI toolkit? There is a number of issues on the repo for versions 3.x.&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import importlib

sequence_module = importlib.import_module('collections')
Sequence = getattr(sequence_module, 'Sequence')&lt;/LI-CODE&gt;&lt;P&gt;or&amp;nbsp;&lt;SPAN&gt;import all the names from the acktoolkit.acitoolkit module. If this fails with an error that contains the string cannot import name "Sequence", then the code imports the Sequence class from the typing module instead. Then, the code raises the original error.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    from acktoolkit.acitoolkit import *
except ImportError as e:
    if 'cannot import name "Sequence"' in str(e):
        # The Sequence class is deprecated
        from typing import Sequence
    else:
        # Another error occurred
        raise&lt;/LI-CODE&gt;&lt;P&gt;I am still thinking its a version issues, i would raise this on the repo too if you have not already&amp;nbsp;&lt;A href="https://github.com/datacenter/acitoolkit" target="_blank"&gt;https://github.com/datacenter/acitoolkit&lt;/A&gt;&amp;nbsp;- however.... i do not know if this is still being maintained?&lt;/P&gt;&lt;P&gt;Funny i typed out all of the above and was also looking at issues and saw this&amp;nbsp;&lt;A href="https://github.com/datacenter/acitoolkit/issues/380" target="_blank"&gt;https://github.com/datacenter/acitoolkit/issues/380&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 09:35:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4906932#M3185</guid>
      <dc:creator>bigevilbeard</dc:creator>
      <dc:date>2023-08-17T09:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: acitoolkit ImportError - cannot import 'Sequence' from 'collection</title>
      <link>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4908340#M3186</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/352839"&gt;@bigevilbeard&lt;/a&gt;, thanks for the assistance.&lt;/P&gt;&lt;P&gt;I guess you were right as par the Python version.&amp;nbsp;Was finally able to find my way around using the 2 links from github you suggested.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Had to do some tweaking of of the source file of the acitoolkit.py file within the acitoolkit package installed on my system.&lt;/P&gt;&lt;P&gt;Thanks again for the assistance.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2023 01:09:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/acitoolkit-importerror-cannot-import-sequence-from-collections/m-p/4908340#M3186</guid>
      <dc:creator>EAG</dc:creator>
      <dc:date>2023-08-20T01:09:03Z</dc:date>
    </item>
  </channel>
</rss>

