How to Upload Microsoft Project File in Google Colab with Python?

image.png (32.2 KB)

Self not defined error when trying to implement the example codes into Google colab for testing. I am building a webapp in colab but the self not defined error is persistent, no matter how explicitly i try to define the module paths or find the relevant functions.

@SHAFEE12

It seems you are using the unit test code snippet to upload Microsoft Project File in Google Colab. I have uploaded a file to the default cloud storage in Google Colab using Aspose.Tasks Cloud SDK for Python and was unable to notice any issue. Please install the Aspose.Tasks Cloud SDK for Python in your Google Colab Notebook and use the following code. It will help you to accomplish the task. Please feel free to contact us for any further assistance.

Install Aspose.Tasks Cloud SDK for Python Package in Google Colab

!pip install aspose-tasks-cloud

Upload a File to Cloud Storage in Google Colab using Aspose.Tasks Cloud SDK for Python Package

import os
import asposetaskscloud
from asposetaskscloud import ApiClient, TasksApi, UploadFileRequest
from shutil import copyfile


# Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).

api_client = asposetaskscloud.ApiClient()
api_client.configuration.host = 'https://api.aspose.cloud'
api_client.configuration.api_key['api_key'] = 'xxxxxxxxxxxxxxxxxxxxxxx'
api_client.configuration.api_key['app_sid'] = 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'
tasks_api = asposetaskscloud.TasksApi(api_client)

local_file_name = '/content/sample_data/mnist_test.csv'
remote_file_name = 'mnist_test.csv'

upload_request = asposetaskscloud.models.requests.UploadFileRequest(remote_file_name, local_file_name)
upload_result = tasks_api.upload_file(upload_request)
print(upload_result)