Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'canvas_manifest' referenced before assignment #46

Closed
frederikbisback opened this issue Nov 7, 2021 · 5 comments
Labels
question Further information is requested

Comments

@frederikbisback
Copy link

An issue in the pipeline step in Azure DevOps:
Config:

image

YAML Config of the above configuration:

#Your build pipeline references an undefined variable named ‘BuildStagingDirectory’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘SolutionName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘BuildStagingDirectory’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘SolutionName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972

steps:

  • task: PythonScript@0
    displayName: 'powerapps-docstring'
    inputs:
    scriptPath: 'powerapps-docstring/main.py'
    arguments: '--source $(BuildStagingDirectory)$(SolutionName)\managed\ --output $(BuildStagingDirectory)$(SolutionName)\managed\ --config powerapps-docstring\config.yaml'
    continueOnError: true

OUTPUT:

2021-11-07T16:05:32.8040424Z ##[section]Starting: powerapps-docstring
2021-11-07T16:05:32.8327632Z ==============================================================================
2021-11-07T16:05:32.8327960Z Task : Python script
2021-11-07T16:05:32.8328195Z Description : Run a Python file or inline script
2021-11-07T16:05:32.8328433Z Version : 0.182.0
2021-11-07T16:05:32.8328748Z Author : Microsoft Corporation
2021-11-07T16:05:32.8329065Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/python-script
2021-11-07T16:05:32.8329462Z ==============================================================================
2021-11-07T16:05:33.1525497Z [command]C:\hostedtoolcache\windows\Python\3.9.7\x64\python.exe D:\a\1\s\powerapps-docstring\main.py --source build\SolutionDemo\managed\ --output build\SolutionDemo\managed\ --config config.yaml
2021-11-07T16:05:33.2411939Z build\SolutionDemo\managed/
2021-11-07T16:05:33.2412839Z Traceback (most recent call last):
2021-11-07T16:05:33.2413325Z File "D:\a\1\s\powerapps-docstring\main.py", line 86, in
2021-11-07T16:05:33.2413942Z main(sys.argv[1:])
2021-11-07T16:05:33.2414362Z File "D:\a\1\s\powerapps-docstring\main.py", line 79, in main
2021-11-07T16:05:33.2414816Z docstring = Docstring(pa_src_path, output_path, config)
2021-11-07T16:05:33.2415299Z File "D:\a\1\s\powerapps-docstring\powerapps_docstring\documentation.py", line 15, in init
2021-11-07T16:05:33.2415796Z self.manifest_file = self.parser.get_canvas_manifest()
2021-11-07T16:05:33.2416293Z File "D:\a\1\s\powerapps-docstring\powerapps_docstring\parser.py", line 44, in get_canvas_manifest
2021-11-07T16:05:33.2416744Z return canvas_manifest
2021-11-07T16:05:33.2417163Z UnboundLocalError: local variable 'canvas_manifest' referenced before assignment
2021-11-07T16:05:33.2524300Z ##[error]The process 'C:\hostedtoolcache\windows\Python\3.9.7\x64\python.exe' failed with exit code 1
2021-11-07T16:05:33.2731262Z ##[section]Finishing: powerapps-docstring

@sebastian-muthwill
Copy link
Owner

The error: powerapps_docstring\parser.py", line 44, in get_canvas_manifest means the CanavasManifest.json file was not found in the source folder.
You provided as sours .../managed/, I guess it is not the base folder of the power apps. Make sure the folder you provide as source contains the CanvasManifest.json file. In the example it ist: example/src/meetingcapturedemo/

I already created an issue to implement better error handling and will log some informations to the console.

@sebastian-muthwill sebastian-muthwill added the question Further information is requested label Nov 7, 2021
@frederikbisback
Copy link
Author

So it's only possible when exporting the canvas app itself?
When using the Azure DevOps pipeline, it's the export of the solution created into the repo.
image

Thanks for the feedback.

@sebastian-muthwill
Copy link
Owner

Currently it's only working with an unpacked .msapp. But this should be possible to unpack the .msapp file within the pipeline.

@frederikbisback
Copy link
Author

Hello Sebastian,

I have implemented your solution into an Azure DevOps pipeline, and the result it's working!
I will write in the coming days a blog post about where I will document the Azure DevOps pipeline.

It's a cool project. I loved to support it further during the new releases.

Keep you posted.

Regards,

Frederik

@sebastian-muthwill
Copy link
Owner

Great to hear. Send me a link to your blog post. Here or on Twitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants