hexagon logo

How to open a python script in pcdmis?

I've got a couple basic scripts running on our programs and you simply go to INSERT > BASIC SCRIPT and chose the .bas file. But it won't let me choose a python file .py.
I tried external command and that doesn't work and I've tried INSERT > FILE I/O COMMAND > FILE OPEN, but when I run the program it runs the program without doing anything inside the python script.

How were those running some python scripts here actually getting pcdmis to open the python script?

Thanks.

Parents
  • When I post the below code into Excel VBA my python script runs fine.
    But when I call the test.bas script in pcdmis 2021 or 2023 I get the below error:

    Runtime Error on line: 4 - Type mismatch



    The error occurs at the line 'Set vbaShell......"

    Sub Main
    
      Dim vbaShell As Object
      Set vbaShell = VBA.CreateObject("Wscript.Shell")
      vbaShell.Run """C:\Users\PNT31\AppData\Local\Programs\Python\Python311\python.exe""" & """C:\Users\PNT31\OneDrive - PNT31\Desktop\test.py"""
    
    End Sub​
    


    Any ideas? I'm going to keep trying...once I can get this to work I am golden.
Reply
  • When I post the below code into Excel VBA my python script runs fine.
    But when I call the test.bas script in pcdmis 2021 or 2023 I get the below error:

    Runtime Error on line: 4 - Type mismatch



    The error occurs at the line 'Set vbaShell......"

    Sub Main
    
      Dim vbaShell As Object
      Set vbaShell = VBA.CreateObject("Wscript.Shell")
      vbaShell.Run """C:\Users\PNT31\AppData\Local\Programs\Python\Python311\python.exe""" & """C:\Users\PNT31\OneDrive - PNT31\Desktop\test.py"""
    
    End Sub​
    


    Any ideas? I'm going to keep trying...once I can get this to work I am golden.
Children
No Data