Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IedConnection_getFile - type error in python #475

Open
Harol2n opened this issue Oct 3, 2023 · 1 comment
Open

IedConnection_getFile - type error in python #475

Harol2n opened this issue Oct 3, 2023 · 1 comment
Labels

Comments

@Harol2n
Copy link

Harol2n commented Oct 3, 2023

Hi,

Im trying to read comtrade files from IEDs, today i can read the file directory and i know exactly where the files are.
The problem is when i try to get the file, using:

iec61850.IedConnection_getFile(con,ruta,downloadHandler,None)

i get the next error TypeError: in method 'IedConnection_getFile', argument 4 of type 'IedClientGetFileHandler'

seeing the file-tool.c file, the 3° argument (downloadHandler) is a function like this:

def downloadHandler(parameter, buffer, bytesRead):
    prmtr = parameter
    if bytesRead >0:
        print("received: ", bytesRead, " bytes")
        return True
    return False

but it just a function, the 3° argument has to be 'IedClientGetFileHandler' type, but i cant do it.
So, how can i get a 'IedClientGetFileHandler' type to the 3 argument?

@KartikSoneji
Copy link

You can't pass a python function to C code directly.
You'll have to wrap the method in a custom handler, easiest will be to get the whole file and return a bytes object to python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants