Error 1671 in LabVIEW When Calling Files Using Python Node

Updated Mar 23, 2020

Reported In

Software

  • LabVIEW

Issue Details

I'm using LabVIEW 2019 SP1 64 bit with Python 3.6.7 64 bit.
When I'm trying to call a file with a Python script, for example:

def file():

    f=
open("filename.txt",'w')
    f.write(
'hi')
    f.write(
'hi2')
    f.close()

    f=
open("d:filename.txt",'r')
    a=f.read()
    f.close()
   
return a

I'm getting the following 1671 error code in LabVIEW:

Python Node in LV64 - Python.vi<APPEND>

Module Path: D:\..\Data\MyPython\LV2019_Classes\
Files.y
Function Name: file
Python returned the following error: <class 'PermissionError'>
[Errno 13] Permisission denied: 'filename.txt'

Solution

Python script called by native LabVIEW functions, can not handle relative paths.
Instead of using relative path for configuration file, have full explicit path.
The following example doesn't return an error.

def file():

    f=
open("d:\\filename.txt",'w')
    f.write(
'hi')
    f.write(
'hi2')
    f.close()

    f=
open("d:\\filename.txt",'r')
    a=f.read()
    f.close()
   
return a