'How to work with MS Project TimeScaleValue object using Python

I'm trying to create a graph with data from an MPP file using win32com.client to read the data. But after consulting Microsoft's documentation, I tried to start with a simple code.

import win32com.client

mppFileName = 'C:/python/test.mpp'

mpp = win32com.client.Dispatch("MSProject.Application")
mpp.visible = 0
    
mpp.FileOpen(mppFileName)
project = mpp.ActiveProject

ResourceList = project.Resources
assignments = project.Assignments
    
for resource in ResourceList:
    if resource.Work != 0:
        print(resource.Name, ' ', resource.Job)
     
mpp.FileClose(Save=0)
  
exit()

But this code generates an error on the assignments= line (Assignments is 'unknown'). Does anyone know the correct way to work with Assignments and TimeScaleValues ​​objects? My goal is to create a graph with the amount of work assigned by week to each project resource.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source