Title: Unable to set StringOut record values · Issue #40 · DiamondLightSource/pythonSoftIOC · GitHub
Open Graph Title: Unable to set StringOut record values · Issue #40 · DiamondLightSource/pythonSoftIOC
X Title: Unable to set StringOut record values · Issue #40 · DiamondLightSource/pythonSoftIOC
Description: I seem to be unable to set the value of a StringOut record programmatically by calling .set(). This program demonstrates the issue: # Import the basic framework components. from softioc import softioc, builder, asyncio_dispatcher # Creat...
Open Graph Description: I seem to be unable to set the value of a StringOut record programmatically by calling .set(). This program demonstrates the issue: # Import the basic framework components. from softioc import soft...
X Description: I seem to be unable to set the value of a StringOut record programmatically by calling .set(). This program demonstrates the issue: # Import the basic framework components. from softioc import soft...
Opengraph URL: https://github.com/DiamondLightSource/pythonSoftIOC/issues/40
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to set StringOut record values","articleBody":"I seem to be unable to set the value of a StringOut record programmatically by calling `.set()`. This program demonstrates the issue:\r\n\r\n```\r\n# Import the basic framework components.\r\nfrom softioc import softioc, builder, asyncio_dispatcher\r\n\r\n# Create an asyncio dispatcher, the event loop is now running\r\ndispatcher = asyncio_dispatcher.AsyncioDispatcher()\r\n\r\n# Set the record prefix\r\nbuilder.SetDeviceName(\"MY-DEVICE-PREFIX\")\r\n\r\n# Create some records\r\nstrout = builder.stringOut(\"FLIBBLE\", initial_value=\"ABC\")\r\n\r\n# Boilerplate get the IOC started\r\nbuilder.LoadDatabase()\r\nsoftioc.iocInit(dispatcher)\r\n\r\nstrout.set(\"DEF\")\r\n\r\n# Finally leave the IOC running with an interactive shell.\r\nsoftioc.interactive_ioc(globals())\r\n```\r\n\r\nThe `strout.set()` line generates this exception:\r\n\r\n```\r\n File \"/home/eyh46967/dev/pythonSoftIoc/docs/examples/trial_stringout.py\", line 17, in \u003cmodule>\r\n strout.set(\"DEF\")\r\n File \"/home/eyh46967/dev/pythonSoftIoc/softioc/device.py\", line 212, in set\r\n datatype, length, data, array = self.value_to_dbr(value)\r\n File \"/home/eyh46967/dev/pythonSoftIoc/softioc/device.py\", line 186, in value_to_dbr\r\n dbrtype = self.NumpyCharCodeToDbr[value.dtype.char]\r\nKeyError: 'U'\r\n```\r\n\r\nThe `device.py` code appears to be trying to convert the string `value` into a numpy array on line 173:\r\n```\r\nvalue = numpy.require(value, requirements = 'C')\r\n```\r\n\r\nExamining this array gives a `value.dtype.char` of `U`, which is unknown to the `NumpyCharCodeToDbr` mapping dictionary. ","author":{"url":"https://github.com/AlexanderWells-diamond","@type":"Person","name":"AlexanderWells-diamond"},"datePublished":"2021-09-30T08:23:30Z","url":"https://github.com/DiamondLightSource/pythonSoftIOC/issues/40"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:55f58667-5a2b-d02c-73c0-78781c50374f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85D0:49A58:5D7599:7E325B:6B04404E |
| html-safe-nonce | 79c07f5e87962749e597ea65077283e57b3c7e1a050e5ec8292a88f39f4f79ba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUQwOjQ5QTU4OjVENzU5OTo3RTMyNUI6NkIwNDQwNEUiLCJ2aXNpdG9yX2lkIjoiNzcwOTY4MTcxNjQ5NTEzODg5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7ad12ec44c67b4c58452f578794211e2492c2a89f186bb8223e893fac8cdfbe2 |
| hovercard-subject-tag | issue:1011871801 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/DiamondLightSource/pythonSoftIOC/40/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4657cd5073d5fb3c44296835f08c262a9d08652dce63bb09d51a0944dec31723/DiamondLightSource/pythonSoftIOC/issues/40 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4657cd5073d5fb3c44296835f08c262a9d08652dce63bb09d51a0944dec31723/DiamondLightSource/pythonSoftIOC/issues/40 |
| og:image:alt | I seem to be unable to set the value of a StringOut record programmatically by calling .set(). This program demonstrates the issue: # Import the basic framework components. from softioc import soft... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AlexanderWells-diamond |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| go-import | github.com/DiamondLightSource/pythonSoftIOC git https://github.com/DiamondLightSource/pythonSoftIOC.git |
| octolytics-dimension-user_id | 1233618 |
| octolytics-dimension-user_login | DiamondLightSource |
| octolytics-dimension-repository_id | 20049394 |
| octolytics-dimension-repository_nwo | DiamondLightSource/pythonSoftIOC |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20049394 |
| octolytics-dimension-repository_network_root_nwo | DiamondLightSource/pythonSoftIOC |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width