Comments (6)
That is not how async programming works. Try a few python asyncio tutorial first
from opcua-asyncio.
That is not how async programming works. Try a few python asyncio tutorial first
I've already gone through basic tutorial. My main program is synchronous, and it needs to execute asynchronous coroutines (connect, browse nodes, read values etc) whenever necessary. That's why asyncio.run() is used for execution at those places. I've used similar approach at multiple places in my program (other than opcua) and it works perfectly.
My expectation is - Using asyncio.run() should always work in a synchronous program.
from opcua-asyncio.
use the sync wrapper if your code is sync
from opcua-asyncio.
use the sync wrapper if your code is sync
asyncio.run() would act like a sync wrapper, if I'm not wrong. Can you suggest an alternative?
from opcua-asyncio.
Calling async code from sync is not that easy. You need a loop running in a thread. But luckily for you I have done that work and you can use the sync wrappers. Look at the sync examples in repository
from opcua-asyncio.
Calling async code from sync is not that easy. You need a loop running in a thread. But luckily for you I have done that work and you can use the sync wrappers. Look at the sync examples in repository
Thanks a lot. Being a newbie in asyncio, I didn't quite give a lot of thought in sync->async handling before opening the issue. BTW, the run_until_complete() method of asyncio worked in this case, since it runs event loop till completion.
from opcua-asyncio.
Related Issues (20)
- Reading Custom Structure with B&R OPC UA client fails with Error 0x80390000 Bad_DataEncodingUnsupported HOT 3
- Error parsing server certificate in Siemens (Sinumerik 840D) miniweb OPC UA Server. Version 4.7 SW HOT 4
- Browsing for HasTypeDefinition references is broken
- DataType Encoding: xml_importer._get_sdef() wrongly assumes, that the first HasEncoding reference represents the default encoding. HOT 5
- Server doens't support Views HOT 2
- how to discover local server from remote client? HOT 4
- Cannot set final bit of signed integers using set_attr_bit
- Cannot set attribute bits for float or double values HOT 1
- Lower Certificate Error in Logs
- DataTypeEncoding object pointed by the "HasEncoding" links should have node class Object instead of ObjectType HOT 1
- Question regarding OperationsLimitsType HOT 1
- Issue importing nested UA extension data types from XML (HasSubType) HOT 1
- OPC-UA datatype Float interpreted as Double by server HOT 3
- Setting publishing interval of subscription doesn't change behaviour HOT 11
- CNC nodeset cannot compile SiOME HOT 1
- Generic Exceptions HOT 2
- RuntimeError: Unknown datatype for field: StructureField HOT 2
- Question: How to filter events on subscription with where_clause HOT 2
- Discrepancy Between _current_connections and CurrentSessionCount in OPC UA Server Implementation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opcua-asyncio.