# Unable to Use CloudLocation Variable in Python Script on Arduino Uno Q (AttributeError)

**URL:** <https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810>\
**Category:** App Lab\
**Created:** [November 22, 2025, 6:49pm UTC](https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810 "2025-11-22T18:49:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ylepors](https://avatars.discourse-cdn.com/v4/letter/y/4bbf92/32.png) [@ylepors](https://forum.arduino.cc/u/ylepors)\
**Post date:** [November 22, 2025, 6:49pm UTC](https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810/1 "2025-11-22T18:49:17Z")

</div>

Hello everyone,

I need some help using a **CloudLocation** variable in a Python script running on an **Arduino Uno Q** (App Lab).

On the Arduino Cloud, I created a **CloudLocation** variable called gpsLocation, which is correctly updated using my iPhone.

However, I’m unable to retrieve the value of this gpsLocation variable from my Python script.

I’ve tried several approaches without success.

Here are some relevant excerpts from my code:

```arduino
from arduino.app_bricks.arduino_cloud import ArduinoCloud

# Variable declaration
_last_location: Dict = {"lat":"0.0","lon":"0.0"}

# Cloud initialization
iot_cloud = ArduinoCloud()

# Display function
def debugGeoloc(client, value):
    lat = value.get("lat", 0.0)
    lon = value.get("lon", 0.0)
    print(f"lat: {lat} - lon {lon}")

# Cloud synchronization
iot_cloud.register("gpsLocation", value=_last_location, on_write=debugGeoloc)

```

The problem occurs on the register call:

```arduino
Traceback (most recent call last):
  File "/app/python/main.py", line 291, in <module>
    iot_cloud.register("gpsLocation", value=_last_location, on_write=debugGeoloc)
    ~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/arduino/app_bricks/arduino_cloud/arduino_cloud.py", line 70, in register
    self._client.register(aiotobj, coro=None, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/arduino_iot_cloud/ucloud.py", line 286, in register
    if not aiotobj.initialized and "r:m" not in self.records:
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/arduino_iot_cloud/ucloud.py", line 121, in __getattr__
    raise AttributeError(f"'{self. __class__. __name__ }' object has no attribute '{attr}'")
AttributeError: 'ArduinoCloudObject' object has no attribute 'initialized'
exited with code 1

```

It seems that the ArduinoCloudObject class used internally does not contain the initialized attribute expected by the Cloud client, which causes the exception as soon as register() is called.

Has anyone already encountered this issue with **CloudLocation** variables or with the Python Cloud API?

Is there a workaround or a specific way to declare/register a CloudLocation variable from Python?

Any help would be greatly appreciated!

Thanks in advance  
Yves

---

<div class="post-metadata">

**Author:** ![ylepors](https://avatars.discourse-cdn.com/v4/letter/y/4bbf92/32.png) [@ylepors](https://forum.arduino.cc/u/ylepors)\
**Post date:** [November 27, 2025, 5:12pm UTC](https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810/2 "2025-11-27T17:12:39Z")

</div>

Hi everyone,

Does anyone have any ideas about the problem and how to solve it?

I may have used "iot\_cloud.register" incorrectly.

---

<div class="post-metadata">

**Author:** ![dido\_neri](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dido_neri/32/930590_2.png) [@dido\_neri](https://forum.arduino.cc/u/dido_neri)\
**Post date:** [November 27, 2025, 9:19pm UTC](https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810/3 "2025-11-27T21:19:27Z")

</div>

Hi, if the variable is a “complex" variable, the register method is a bit different.  
You can have a look at the examples of the arduino\_cloud brick, and the example of the arduino-iot-cloud.

> <https://github.com/arduino/arduino-iot-cloud-py/blob/c3827d31d604f3fc992646d17b5060cb2efd0ecf/examples/example.py#L100>

> <https://github.com/arduino/app-bricks-py/blob/3b0658f9286a83b951b1187e3446ae77c91382e6/src/arduino/app_bricks/arduino_cloud/examples/2_light_with_colors_monitor.py#L19>

In your case, I think you had to do something like:

```python
from arduino.app_bricks.arduino_cloud import ArduinoCloud, Location

# Cloud initialization
iot_cloud = ArduinoCloud()

# Display function
def debugGeoloc(client, value):
    print(f"lat: {value.lat} - lon {value.lon}")

# Cloud synchronization
iot_cloud.register(Location("gpsLocation", lat=31.264694, lon=29.979987, on_write=debugGeoloc))

```

Let me know if it works.

---

<div class="post-metadata">

**Author:** ![ylepors](https://avatars.discourse-cdn.com/v4/letter/y/4bbf92/32.png) [@ylepors](https://forum.arduino.cc/u/ylepors)\
**Post date:** [November 28, 2025, 10:07am UTC](https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810/4 "2025-11-28T10:07:06Z")

</div>

It works!  
Thanks a lot for the help @dido_neri  
Have a good day 🙂

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 27, 2026, 10:07am UTC](https://forum.arduino.cc/t/unable-to-use-cloudlocation-variable-in-python-script-on-arduino-uno-q-attributeerror/1415810/5 "2026-05-27T10:07:29Z")

</div>

Closed on May 27, 2026, 10:07am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
