Local Development server when opening "Datastore Viewer"

Skip to first unread message

Khaled Wagdy

Aug 12, 2022, 5:56:30 PM8/12/22
to Google App Engine

I am using Python 2.7 on AppEngine and Datastore. I moved my code & test database file to another laptop, I also made a fresh install of gcloud components, currently at version 397.0.0.

Ever since then, trying to access local datastore viewer "http://localhost:8000/datastore?kind=<kind>" from the browser causes as ascii error as seen in the screenshot below and server output. I have some Arabic content in the DB, but on the old laptop which was running an old gcloud components version (270.0.0) there was no problem browsing through the entities.

I will try to install the old version 270.0.0 using the command gcloud components update --version 270.0.0 and see if that resolves it. But I would think working on the latest version is best in case something can be fixed to resolve this matter.

Has there been a breaking update in the local development server and/or datastore emulator that might have been causing this issue? Is there a way around this ascii error to be able to browse through the local DB entities without problems? This is important during debugging, and can save a lot of time.

Screen Shot 2022-08-12 at 18.02.18.pngERROR    2022-08-12 16:05:04,764 webapp2.py:1553] 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
Traceback (most recent call last):
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/admin/admin_request_handler.py", line 88, in dispatch
    super(AdminRequestHandler, self).dispatch()
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/admin/datastore_viewer.py", line 674, in get
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/admin/datastore_viewer.py", line 625, in _get_entity_template_data
    value = data_type.format(raw_value)
  File "/Users/khaled/Documents/darna/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/admin/datastore_viewer.py", line 200, in format
    return str(value)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

Thank you,

Khaled Wagdy

Aug 15, 2022, 11:37:15 AM8/15/22
to Google App Engine
So I moved to ver. 270.0.0 indeed the problem has gone, which indicates that there was some string/unicode/ascii related update along the way that may have broken its ability to handle Unicode characters. I also tried versions 396, 383, 380 all had the same problem and error output. 

If someone can look into this so that we can work with the latest Google Cloud CLI versions, it would be great!

Have a nice day,

Rogelio Monter Rodriguez

Aug 16, 2022, 12:50:48 PM8/16/22
to Google App Engine

As shown in the Local Development Server Options documentation:

Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3.

About Python 2 support in Google Cloud:

The Python community announced that it will sunset Python 2 on January 1, 2020, and are encouraging all developers to upgrade to Python 3 as soon as they can. In recognition that customers may need more time to migrate from Python 2 to Python 3, Google Cloud customers will be able to run Python 2 apps and use existing Python 2 client libraries after January 1, 2020.

Managed compute services, such as App Engine, will continue to provide a Python 2 runtime beyond January 1, 2020. Python 2 client libraries will continue to be available for download, but future major releases will only target Python 3.

Google Cloud CLI

Google Cloud CLI version 274.0.0 introduces support for Python 3. Older versions of the gcloud CLI will remain available for download, but we recommend using version 274.0.0 or newer and migrating to Python 3 as soon as possible.

The best way to report this kind of issues is with issue tracker as you have done:

About Issue reports:

Google reviews every new issue report submitted by users. Sometimes one of our staff will ask for clarification or followup. After we're able to replicate the issue, we'll tell you that it's been forwarded to the appropriate team.

Depending on the circumstances, we may be able to provide periodic updates while an issue is being looked at, but usually we cannot provide too many specifics about the exact cause of an issue, or when it will be fixed.

When we've fixed an issue in production, we'll indicate this and then we'll close the issue.

If you need further assistance, you can create a Support case.

limin xiao

Aug 31, 2022, 8:37:59 AM8/31/22
to Google App Engine
Had the same issue, but ver. 340.0.0 was proved fine.

Khaled Wagdy

Sep 12, 2022, 9:38:55 PM9/12/22
to Google App Engine
Thank you very much =D! 340.0.0 worked indeed,
Reply all
Reply to author
0 new messages