使用自定义Web服务器共享锚ID无效 [英] Using a custom web server for sharing Anchor IDs doesn't work

查看:160
本文介绍了使用自定义Web服务器共享锚ID无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用自己的Python cgi脚本来存储和提供锚ID.一切都与示例存储库中的Swagger Sharing Server一起使用,但是以某种方式切换到Python服务器时出现错误,并且应用程序一直在寻找锚点.

I'm trying to use my own Python cgi script to store and serve Anchor IDs. Everything worked with the Swagger Sharing Server from the samples repository but somehow when I switch to my Python server I get an Error and the app is stuck looking for the anchor.

我想我做的是,与Swagger脚本完全一样:我将Anchor ID发送到服务器,并返回一个Anchor编号,以便以后可以再次请求该ID. 据我了解,ID需要以字符串形式交换,这也是我从Python服务器返回的内容(内容类型:文本/纯文本).

What I'm doing is, I assume, exactly the same the Swagger Script does: I send the Anchor ID to the server and return an Anchor number to be able to request the ID later again. As far as I understood the ID needs to be exchanged as a string and that's what I return from my Python server as well (Content-type: text/plain).

但是,当我从服务器上获取密钥时,尝试解析密钥/查找锚ID时,我在Android上出现以下错误:

However I get following error on my Android when trying to parse the key / look for the Anchor ID once I got it from the server:

这是logcat的相关错误消息:

Here's the relevant error message from logcat:

04-29 07:33:01.031: I/Unity(28756): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
04-29 07:33:02.062: I/Unity(28756): State from DemoStepLookForAnchor to DemoStepLookingForAnchor
04-29 07:33:02.062: I/Unity(28756):  
04-29 07:33:02.062: I/Unity(28756): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
04-29 07:33:02.141: E/Unity(28756): InvalidOperationException: bad lexical cast: source type value could not be interpreted as target. Request CV: . Response CV: .
04-29 07:33:02.141: E/Unity(28756):   at Microsoft.Azure.SpatialAnchors.NativeLibraryHelpers.CheckStatus (System.IntPtr handle, Microsoft.Azure.SpatialAnchors.status value) [0x000cc] in <b52d7a321113460294136f243fd7bd66>:0 
04-29 07:33:02.141: E/Unity(28756):   at Microsoft.Azure.SpatialAnchors.CloudSpatialAnchorSession.CreateWatcher (Microsoft.Azure.SpatialAnchors.AnchorLocateCriteria criteria) [0x00019] in <b52d7a321113460294136f243fd7bd66>:0 
04-29 07:33:02.141: E/Unity(28756):   at Microsoft.Azure.SpatialAnchors.Unity.Samples.AzureSpatialAnchorsDemoWrapper.CreateWatcher () [0x00008] in <b52d7a321113460294136f243fd7bd66>:0 
04-29 07:33:02.141: E/Unity(28756):   at Microsoft.Azure.SpatialAnchors.Unity.Samples.AzureSpatialAnchorsSharedAnchorDemoScript.AdvanceLocateFlowDemo () [0x00090] in <b52d7a321113460294136f243fd7bd66>:0 
04-29 07:33:02.141: E/Unity(28756):   at Microsoft.Azure.SpatialAnchors.Unity.Samples.AzureSpatialAnchorsSharedAnchorDemoScript.AdvanceDemo () [0x00018] in <b52d7a321113460294136f243fd7bd66>:0 
04-29 07:33:02.141: E/Unity(28756):   at Microsoft.Azure.SpatialAnchors.Unity.

可能是什么问题? 提前非常感谢!

What could be wrong? Many thanks in advance!

推荐答案

JanLa 在评论中回答:

问题是我对Python的一半了解:除了使用不可靠的数据库(anydbm更好)之外,我还犯了一个错误,该错误通过print输出Anchor ID字符串,这在末尾添加了一个换行符,从而使之无效锚点ID.现在使用sys.stdout.write,效果很好.

The issue was my half knowledge of Python: Apart from using an unreliable database (anydbm is much better) I made the mistake to output the Anchor ID string via print which adds a line-break at the end and thus invalidates the Anchor ID. Using sys.stdout.write now and it works perfectly.

这篇关于使用自定义Web服务器共享锚ID无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆