LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

python shared memory object

Solved!
Go to solution
  • Hello everyone, I have a puzzle to consult.
  • I created a shared memory object in Python and wrote data to the shared memory. Can labview read this data written by python?
  • I want to create a data sending and receiving area between Python and labview, and I wonder if it can be implemented this way.
  • Looking forward to your reply.
0 Kudos
Message 1 of 24
(1,764 Views)
Solution
Accepted by hallo77

Being two different processes, LabVIEW and Python cannot share the same memory space. The Python node in LabVIEW does some level of marshalling/translation between the data spaces.

 

Better option, write to a file from Python, read that file in LabVIEW. You're not limited in data types and complexity.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 24
(1,715 Views)
Thanks for your reply! This not only solved my confusion, but also provided me with valuable ideas. Thank you very much!
0 Kudos
Message 3 of 24
(1,712 Views)
Solution
Accepted by hallo77

@santo_13 wrote:

Being two different processes, LabVIEW and Python cannot share the same memory space. The Python node in LabVIEW does some level of marshalling/translation between the data spaces.

 

Better option, write to a file from Python, read that file in LabVIEW. You're not limited in data types and complexity.


Personally I would be more inclined to use a server/client mechanism for passing data between the two processes. This provides a more flexible approach. You could use a JSON format for the data and that would ensure both sides would know how to interpret it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 24
(1,699 Views)

Thank you for your reply.

Yes, it's great idea. however, I want to construct a data sending and receiving area between Python and labview, Python keeps storing data in it, and labview periodically retrives data.I'm not sure can this be done through the server/client mechanism.

Transiting through text seems feasible, but it also has certain limitations. But I can't think of a better way.

0 Kudos
Message 5 of 24
(1,688 Views)
Solution
Accepted by hallo77

@Mark_Yedinak wrote:

@santo_13 wrote:

Being two different processes, LabVIEW and Python cannot share the same memory space. The Python node in LabVIEW does some level of marshalling/translation between the data spaces.

 

Better option, write to a file from Python, read that file in LabVIEW. You're not limited in data types and complexity.


Personally I would be more inclined to use a server/client mechanism for passing data between the two processes. This provides a more flexible approach. You could use a JSON format for the data and that would ensure both sides would know how to interpret it.


Of course, that will be a better approach if you need both application transfer often and support variety of comms.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 6 of 24
(1,685 Views)

@hallo77 wrote:

Thank you for your reply.

Yes, it's great idea. however, I want to construct a data sending and receiving area between Python and labview, Python keeps storing data in it, and labview periodically retrives data.I'm not sure can this be done through the server/client mechanism.

Transiting through text seems feasible, but it also has certain limitations. But I can't think of a better way.


Providing more detail about the application, why it has to be Python and LabVIEW, what kind of data, how large and how often - these will help suggest better solution if there are.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 7 of 24
(1,682 Views)

Well, I want to create a host computer using Python and labview. Python to achieve communication and data processing, labview try not to add too complex procedures, mainly data display functions. But the transfer of data between them is a problem, do you have any suggestions? Thank you very much!

0 Kudos
Message 8 of 24
(1,671 Views)

More about it.It's not a huge amount of data, a dozen of it, of the type uint16. What time does time mean? The data read time of the timer is about 200ms.

0 Kudos
Message 9 of 24
(1,659 Views)

you can use TCP or UDP to interchange data over ethernet between a labview .vi or .exe and a python script.

0 Kudos
Message 10 of 24
(1,654 Views)