Write a value with opc ua Python - python-3.x

i trying write value with this example :
opc ua client to server
But i have this error :
Exception "unhandled opcua.ua.uaerrors._auto.BadTypeMismatch"
"The value supplied for the attribute is not of the same type as the attribute"s value."(BadTypeMismatch)
File: C:\Users\lari\AppData\Local\Programs\Python\Python38\lib\site-packages\opcua\ua\uatypes.py, Line: 218
someone can help me please
thank you so much

I find \o/
this link help me : https://github.com/FreeOpcUa/opcua-asyncio/issues/30
dv = ua.DataValue(ua.Variant(122, ua.VariantType.Int32))
dv.ServerTimestamp = None
dv.SourceTimestamp = None
trou.set_value(dv)
I hope my adventure can help others ;)

This is telling you the server is expecting a value with a different datatype than the one you wrote.

Related

bioMart Package error: error in function useDataset

I am trying to use the biomaRt package to access the data from Ensembl, however I got error message when using the useDataset() function. My codes are shown below.
library(httr)
listMarts()
ensembl = useMart("ENSEMBL_MART_ENSEMBL")
listDatasets(ensemble)
ensembl = useDataset("hsapiens_gene_ensembl",mart = ensemble)
When I type useDataset function i got error message like this:
> ensembl = useDataset("hsapiens_gene_ensembl",mart = ensembl)
Ensembl site unresponsive, trying asia mirror
Error in textConnection(text, encoding = "UTF-8") :
invalid 'text' argument
and sometimes another different error message showed as:
> ensembl = useDataset("hsapiens_gene_ensembl",mart = ensembl)
Ensembl site unresponsive, trying asia mirror
Error in textConnection(bmResult) : invalid 'text' argument
it seems like that the mirror automatically change to asia OR useast OR uswest, but the error message still shows up over and over again, and i don't know what to do.
So if anyone could help me with this? I will be very grateful for any help or suggestion.
Kind regards Riley Qiu, Dongguan, China

Error occurred on routing_api __get _route response status code 403

I'd like to compute the travel time between two points. So I use the RoutingApi from herepy library (as reported in the example at https://github.com/abdullahselek/HerePy/blob/master/examples/routing_api.py):
from herepy import (
RoutingApi,
RouteMode,
MatrixRoutingType,
MatrixSummaryAttribute,
RoutingTransportMode,
RoutingMode,
RoutingApiReturnField,
RoutingMetric,
RoutingApiSpanField,
AvoidArea,
AvoidFeature,
Avoid,
Truck,
ShippedHazardousGood,
TunnelCategory,
TruckType,
)
routing_api = RoutingApi(api_key="my_key")
response = routing_api.truck_route(
waypoint_a=[lat_a, lon_a],
waypoint_b=[lat_b, lon_b],
modes=[RouteMode.truck, RouteMode.fastest],
)
print(response.as_dict())
Though, even if my api key is valid and "enabled" on the HERE developer platform, I get the following error message:
HEREError: Error occurred on routing_api __get _route response status code 403
Can anyone explain to me why is this happening and how to solve that? Thank you in advance.
The issue is with coordinates.
Looking at the example at https://github.com/abdullahselek/HerePy/blob/master/examples/routing_api.py
if you try:
response = routing.car_route(waypoint_a=[41.9798, -87.8801], waypoint_b=[41.9043, -87.9216], modes=[herepy.RouteMode.car, herepy.RouteMode.fastest])
print(response.as_dict())
it should work.

Python firebase_admin.credentials has no attribute Certificate

I'm currently developing for GCP and had used this code already many many times (this is running on RPI3 python 3.7)
def createClient(projid, dev_name):
base = os.getcwd()
base = base.replace("\\",'/')
keydir = '{}/Devices/{}/firebase.json'.format(base, projid.lower())
print(keydir)
cred = credentials.Certificate(keydir)
firebase_admin.initialize_app(cred, {
'databaseURL': 'https://{}.firebaseio.com/'.format(projid.lower())
}, name= dev_name)
But now the code fails with message:
module 'firebase_admin.credentials' has no attribute 'Certificate'>
Please note this code it's working correctly in other RPI why is this not working?!
the error occurs in this line of code:
cred = credentials.Certificate(keydir)
anyone with a clue would be very very appreciated.
Kind Regards!
Edit: I've tried with:
cred = credentials.RefreshToken(keydir)
still the same result now with the error:
module 'firebase_admin.credentials' has no attribute 'RefreshToken'>
note I'm using a service account json file as a key.
Edit2: I missed to add this info in the original post:
firebase-admin==2.17.0
this is all running in a Raspberry Pi 3 B+ (RPI)

Recursively getting body of email with Pyzmail module

I'm trying to create an app that needs to recursively check an email address for new emails and then do some other stuff; I'm having some problems with the getting the body of the emails, though. I'm using the pyzmail module alongside imapclient, and the Automate the Boring Stuff for guidance (with python 3.6). Here's my code:
mail = imapclient.IMAPClient('imap.gmail.com', ssl=True)
mail.login('email', 'password')
mail.select_folder('INBOX', readonly=False)
uid = mail.gmail_search('NC')
for i in uid:
message = mail.fetch(i, ['BODY[]'], 'FLAGS')
msg = pyzmail.PyzMessage.factory(message[i][b'BODY[]'])
msg.html_part.get_payload().decode(msg.text_part.charset)
But it's not working. I've basically tried different forms of this code but to no avail and there's really not that many examples that can help me along. I'm a bit of a python newbie. Can anybody help?
Thanks,
EDIT
I realized where I made a mistake and fixed a bit of the code:
server = imapclient.IMAPClient('imap.gmail.com', ssl=True)
server.login('p.imagery.serv#gmail.com', 'rabbitrun88ve')
server.select_folder('INBOX', readonly=True)
uids = server.gmail_search('NC')
for i in uids:
messages = server.fetch(i, ['BODY[]'])
msg = pyzmail.PyzMessage.factory(messages[b'BODY[]'])
The problem I'm having is with the last line, which I dont know how to fed using the variables that is created with the iterator. It throws out this message:
ValueError: input must be a string a bytes, a file or a Message
I'm not sure if you still have this problem but for those who might have similar issues in future.
I noticed a little omission in the last line which might be the culprit.
msg = pyzmail.PyzMessage.factory(messages[b'BODY[]'])
You omitted the 'i' variable of the for loop
msg = pyzmail.PyzMessage.factory(messages[i][b'BODY[]'])
I'd like to do next to get body text of searched messages:
server = imapclient.IMAPClient('imap.gmail.com', ssl=True)
server.login('p.imagery.serv#gmail.com', 'rabbitrun88ve')
server.select_folder('INBOX', readonly=True)
uids = server.gmail_search('NC')
rawmessage = server.fetch(uids, ['BODY[]'])
for i in rawmessage:
msg = pyzmail.PyzMessage.factory(rawmessage[i][b'BODY[]'])
msg.html_part.get_payload().decode(msg.text_part.charset)
In this case, you get iteration over fetched emails with body text. I checked similar example but I used text_part.get_payload() instead html regarding features of my server.

how to check if a colmmande return is true or false selenium-ide

I'm trying to get a command return with selenium ide by doing it :
storeTextPresent|myText|title
gotoIf|storedVars.tite|true
echo|${"true"}
but it doesnt work...i have : [error] Unexpected Exception: fileName -> chrome://flowcontrol/content/extensions/goto-sel-ide.js?1347871647495, lineNumber -> 120.
Does anybody know how to get the return?
Thank you
I didn't check for boolean support on gotoIf, but if gotoIf wants to go to a label, I don't see a label defined in the above script.
Also, the "storedVars.tite" reference looks to be misspelled.

Resources