The Windows Store app Python 3 For Metro claims that it allows users to edit and run Python files (I can't get it to work). How is this possible from within the sandbox? Can I run a file (say test.py
on the desktop) from my JavaScript app?
How is this possible from within the sandbox?
I have ported the Python interpreter to WinRT to achieve that. Instead of using Win32 API, it now uses WinRT API (in particular for reading files from the user's Documents folder).
Can I run a file (say test.py on the desktop) from my JavaScript app?
In principle, yes. You need to take the python33.dll from my app, wrap it as a WinRT component, and then call it. It actually is a WinRT component already, but doesn't expose any of the Python API. See
http://hg.python.org/sandbox/loewis/file/ee9f8c546ddd/win8app/python33
Basically, what you need to do is write a C++ "shell" app according to the Metro rules, then host the Python interpreter inside that C++ app. And again, scrub the Python codebase so that it runs within the Metro sandbox.
You can then go a step further, and have the C++ shell expose WinRT libraries to the Python environment. There's probably a way to get Python to expose WinRT objects, but that would be a LOT of work.
You won't be able to call directly from JavaScript into Python - you'll need a WinRT component in the middle.
This is a lot of work, and requires some fairly low level work in C.
You have two options:
add python.exe to your PATH and, from within a terminal, enter the folder that contains your test.py and run python.exe test.py, using your current installation
you can follow step1 and step2 of this post and install a brand new python from scratch
If you can provide some more informations, we can help you better.
Can I run a file (say test.py on the desktop) from my JavaScript app?
This can be your real problem, what do you mean with this statement? generally the answer would be "no, you can't"
© 2022 - 2024 — McMap. All rights reserved.