Got the error message for the script on web page from aspose.tasks proive

After pip install aspose-tasks, run the script that aspose web page provide. I got the error message as following: Traceback (most recent call last): File “/home/sdo/文件/python/AsposeTask/task.py”, line 1, in import aspose.tasks as tsk File “”, line 1027, in _find_and_load File “”, line 1006, in _find_and_load_unlocked File “”, line 672, in _load_unlocked File “”, line 640, in _load_backward_compatible KeyError: ‘aspose.tasks’,

Any guide for the issue?

1 Like

@AnsonHuang ,
could you specify what script do you try to run?

1 Like

The script is in this link : Python Project procesing API | Aspose.Tasks product family

import aspose.tasks as tsk

# Open existing project
prj = tsk.Project("HelloProject.mpp")
# Save to PDF
prj.save("output.pdf", tsk.saving.SaveFileFormat.PDF)

os: ubuntu 22.04
python: 3.10

@AnsonHuang ,
looks like your Python Interpreter cannot locate or access the installed package.

The issue can occur when you have several Python installation on the machine.

You can check the folder where the package is located using ‘pip show aspose-tasks’.
Please ensure that your Python Interpreter \ IDE uses this folder.

1 Like

Many thanks for your reply. For my developing machine, installed anaconda for the python virtual environment. It would be this kind of problem. I will try another way for the virtual environment.

2 Likes

I got another error message as following:" RuntimeError: Proxy error(TasksRenderingException): Cannot find fallback font ‘Generic Sans Serif’. Please check that the system font folders or font folders specified in FontSettings contain True Type font files."

OS: ubuntu 22.04
Python: 3.11.4

Package Version


aspose-tasks 23.10.0
pip 23.3.1
setuptools 65.5.0

1 Like

@AnsonHuang ,
could you check that system font folder of your ubunu 22.04 contains font with name ‘Generic Sans Serif’ ?

There are lots of fonts in this folder : /usr/share/fonts, without “Generic Sans Serif”. After googling “Generic Sans Serif”, It’s same.

@AnsonHuang ,
another option is to install package ‘ttf-mscorefonts-installer’ to ensure that fonts usually used by Microsoft Project are installed.

Thanks! It solved this issue.(font error message) :slightly_smiling_face:

1 Like