0

So, I made a Python file (.py) and I want to convert it into a PowerShell file (.ps1)
I tried this tool: https://github.com/x-j/ps1scriptify but every time I give it a .py file, it says:
Python script provided is not callable (does not contain a main block)
So I changed this: print("Hello, World") to this:
def main():
print("Hello, world")
main()
It still gives me the same error mentioned above.
Any help please?

1
  • Why not call the python script from your PowerShell script, like python my_module.py would execute your script and you can even store it in a variable to access outputs. Commented Aug 31, 2020 at 2:46

1 Answer 1

1

That conversion script is expecting to see a block like

if __name__ == '__main__':
    main()

so pop that into your script instead of just the raw call to main().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.