DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Standard Python method missing in DIAdem

Solved!
Go to solution

I am using DIAdem 2025 Q2 with Python 3.12 (installed via miniforge) on Windows 11, and wrote a Python dataplugin to import a specific filetype, using datetime.datetime.strptime to convert a timestamp (my test case is 17Sep25144020 representing 17 September 2025 14:40:20) to a datetime object using "%d%b%y%H%M%S" as the format string. When I test the dataplugin using the same Python installation, I get the expected results. However, when try to use it within DIAdem, I get a log file with the error "PYM: ERROR: Error in python script: attribute of type 'NoneType' is not callable", indicating that strptime exists but isn't method of datetime.

 

When I remove the strptime conversion, the import works perfectly, albeit without the converted timestamp.

 

From the autocompletion (below) I can see that there is no datetime.datetime.strptime method available; however, when I check the source location (as shown in the autocompletion tooltip), the strptime method is present in the source file (and is from the same Python installation with which I tested the code). 

 

Screenshot 2025-11-04 075313.png

 

Can anyone shed some light on why strptime is not working in DIAdem?

0 Kudos
Message 1 of 3
(170 Views)
Solution
Accepted by topic author ervanhorn

Have a look at https://operations.systemlink.io/python-dataplugins/python-dataplugins/ 

 

There is an open issue with this method.

Use 

def strptime(self, value, format):
   return datetime.datetime(*(time.strptime(value, "%d.%m.%y %H:%M:%S")[0:6]))

as a workaround.

0 Kudos
Message 2 of 3
(140 Views)

Thanks, I didn't know about that issue with Python, and clearly it has been a problem for some time! That workaround is more concise than the one I devised, so I modified my code and it worked perfectly.

0 Kudos
Message 3 of 3
(132 Views)