# Python OPC-UA client: add\_folder() gives BadNotSupported

**URL:** <https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882>\
**Category:** Ignition\
**Created:** [April 26, 2022, 4:25pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882 "2022-04-26T16:25:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon.de.Kraa](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@Simon.de.Kraa](https://forum.inductiveautomation.com/u/Simon.de.Kraa)\
**Post date:** [April 26, 2022, 4:25pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/1 "2022-04-26T16:25:12Z")

</div>

Hello,

When I try to add a folder using the Python OPC-UA client from [here](https://github.com/FreeOpcUa/python-opcua) I get the following error:

```auto
opcua.ua.uaerrors._auto.BadNotSupported: "The requested operation is not supported."(BadNotSupported)

```

The user has the role ReadWrite assigned.

I’m not sure if the code is wrong or I need to change something in Ignition?

Any guidance is much appricated!

Sample code:

```auto
from opcua import ua
from opcua import Client
import sys
sys.path.insert(0, "..")

if __name__ == " __main__":
    client = Client("opc.tcp://localhost:62541/")
    client.set_user("test")
    client.set_password("test")

    try:
        client.connect()

        test = client.get_node("ns=2;s=[Sample_Tags]")
        print("Info: ", test)

        test.add_folder("ns=2;s=[Sample_Tags]/Test", "Test")
    finally:
        client.disconnect()

```

Output:

```auto
Requested session timeout to be 3600000ms, got 120000ms instead
Info: ns=2;s=[Sample_Tags]
Traceback (most recent call last):
  File "/home/simon/Projects/opcua-client/test copy.py", line 31, in <module>
    test.add_folder("ns=2;s=[Sample_Tags]/Test", "Test")
  File "/home/simon/Projects/opcua-client/venv/lib/python3.8/site-packages/opcua/common/node.py", line 658, in add_folder
    return opcua.common.manage_nodes.create_folder(self, nodeid, bname)
  File "/home/simon/Projects/opcua-client/venv/lib/python3.8/site-packages/opcua/common/manage_nodes.py", line 41, in create_folder
    return node.Node(parent.server, _create_object(parent.server, parent.nodeid, nodeid, qname, ua.ObjectIds.FolderType))
  File "/home/simon/Projects/opcua-client/venv/lib/python3.8/site-packages/opcua/common/manage_nodes.py", line 171, in _create_object
    results[0].StatusCode.check()
  File "/home/simon/Projects/opcua-client/venv/lib/python3.8/site-packages/opcua/ua/uatypes.py", line 218, in check
    raise UaStatusCodeError(self.value)
opcua.ua.uaerrors._auto.BadNotSupported: "The requested operation is not supported."(BadNotSupported)

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 26, 2022, 4:26pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/2 "2022-04-26T16:26:27Z")

</div>

Ignition’s OPC UA server doesn’t support the Node Management services. You can’t arbitrarily create Nodes in the server.

---

<div class="post-metadata">

**Author:** ![Simon.de.Kraa](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@Simon.de.Kraa](https://forum.inductiveautomation.com/u/Simon.de.Kraa)\
**Post date:** [April 26, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/3 "2022-04-26T16:33:28Z")

</div>

Ah, our intention was to do device management elsewhere and create the appropriate nodes in Ignition programmatically.

Are you saying that there is no way to do this? In other words we need to do this statically/manually from within Ignition?

Thanks.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f67fb11a31ed7bfeaeeb29bb320288731a139409.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 26, 2022, 4:34pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/4 "2022-04-26T16:34:03Z")

</div>

> [@Simon.de.Kraa](#):
>
> Are you saying that there is no way to do this? In other words we need to do this statically/manually from within Ignition?

Correct.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 26, 2022, 4:34pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/5 "2022-04-26T16:34:47Z")

</div>

While you can’t do it via OPC UA, you might be able to use the WebDev module to expose REST endpoints that use the `system.device` scripting functions to configure devices.

---

<div class="post-metadata">

**Author:** ![Simon.de.Kraa](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@Simon.de.Kraa](https://forum.inductiveautomation.com/u/Simon.de.Kraa)\
**Post date:** [April 26, 2022, 4:50pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/6 "2022-04-26T16:50:42Z")

</div>

If I look at `system.device` in the [docs](https://docs.inductiveautomation.com/display/DOC80/system.device), it looks like there is no way to actually define the folder structure, tags etc. right? Just define a device that will receive data through a specific driver. Or am I missing something?

I basically need to define the whole folder structure, tag definitions from outside Ignition. The “devices” are actually pseudo devices that I will write data to from outside Ignition.

I need to define something similar using code:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/b/8b285effbacfb8b42b2868a849e9058c207181e5.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 26, 2022, 4:58pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/7 "2022-04-26T16:58:34Z")

</div>

In that case you probably don’t want `system.device`, but rather you want `system.tag.configure`, and you’d just be creating folders full of memory tags.

These would be Ignition tags you create, so in order to see them the “Exposed Tags” feature of the OPC UA server must be enabled.

[https://docs.inductiveautomation.com/display/DOC81/system.tag.configure](https://docs.inductiveautomation.com/display/DOC81/system.tag.configure)

---

<div class="post-metadata">

**Author:** ![Simon.de.Kraa](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@Simon.de.Kraa](https://forum.inductiveautomation.com/u/Simon.de.Kraa)\
**Post date:** [April 26, 2022, 5:22pm UTC](https://forum.inductiveautomation.com/t/python-opc-ua-client-add-folder-gives-badnotsupported/58882/8 "2022-04-26T17:22:21Z")

</div>

Ok, so I’m basically defining Python functions (using `system.*`) for creating folders and tags using the WebDev module. I can call these functions from outside Ignition using REST API.
