Jump to content

Calling Own Modules/Scripts through LabPython


Recommended Posts

Hi,

I try to use LabPython with Python 2.7.8. After some difficulties in the beginning I am now able to run simple scripts and also import certain modules, for example the following:

import numpy

sampling = 1/timestep
millivoltage = numpy.std(voltage)*1000

But if I now try to add a def statement (like the one below) to the script, the VI gets stuck at PYTHON Execute Script (if it is called) or throws a ZeroDivisionError (if it is just added but not called in the script):

def test():
     return 0

Are there certain things that are forbidden when using LabPython like certain statements? I just noticed that I have to put the def to the beginning.

 

If I now try to add a self written module to python and try to load it the PYTHON Execute Script VI freezes as well. I attached the file.

What would be the right way to use a self written module in LabPython? Can I put the file somewhere, where LabPython is checking? In which directory is LabPython running?

 

Furthermore I wonder if there is any way to run a script file in LabPython, or do I always have to copy the code to a String-Box?

 

Best, Erik

timetrace_processing.zip

Edited by Erik Hebestreit
Link to comment

It seems like I can track down the issue to the use of certain modules that cannot be imported. In particular LabPythons Execute Script VI freezes when I try to import

- scipy.signal

- scipy.optimize.curve_fit

 

I don't know what is special about them compared with other modules like scipy.constants.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.