Access Violation Reading 0x0000000000000008 in NI Python Module

Updated Mar 6, 2024

Reported In

Programming Language

  • Python

Issue Details

  • I'm writing a Python script that utilises one of the NI Python modules. Whenever I run my script, I see OSError: exception: access violation reading 0x0000000000000008. What causes this?
  • I am using the nifpga Python library. When I run my script in Python 32-bit, it works. As soon as I run the same script in Python 64-bit, I receive error 0x0000000000000008. How can I resolve this?
  • After importing an NI Python module into my Python 64-bit script, the script produces exit code 1 and an access violation. Sometimes, the script runs without any errors.

Solution

This error can be caused by a number of factors, depending on the behaviour that's observed. These factors include:
  • Anti-virus or security software blocking Python DLLs from executing properly.
  • Null pointers within the script.
  • Corrupt Python installation.
  • Corrupt bitfile (if using the nifpga library).

Follow the steps below to identify and resolve the cause of the error:
  1. If the error only occurs with 64-bit Python, or if the error only occurs sometimes, temporarily remove any 3rd party anti-virus or security software.
    • Access violation 0x0000000000000008 indicates that Python was unable to perform a read operation, so it's possible that the anti-virus is blocking the required DLLs from running.
  2. Verify whether any example scripts run without errors. Depending on the NI Python module used, examples can be found in the following links:
  3. Review your script and check whether any pointers are created above the line that produces the error. It's possible that a user-defined pointer becomes NULL at runtime.
  4. Try reinstalling Python and the NI Python module to verify that the installation is not corrupt.
    • Checking the behaviour of the same script, module and Python version on another PC will also verify if the installation was corrupt.
  5. If using the [External] nifpga library, it's possible that the bitfile is corrupt. Try recompiling the bitfile in LabVIEW and then re-running your script.