holzschu / holzschu/a-shell

Not able to run python script from shortcuts (in extension)

Open
#295 7 comments 0 reactions 0 assignees View on GitHub
fix committed
Dominant language
Perl
Stars
3.9k
Forks
213
Avg merge
1m
Merged PRs (30d)
1

Description

Hi,

First things first, thanks a ton for building this. It’s literally the only way I can create some of the shortcuts I had in mind.

I’ve tried searching for this before but wasn’t able to find much that could help me.
I have a very simple script in the `$SHORTCUTS` folder:
```
$ cat $SHORTCUTS/simple.py
#!/usr/bin/env python3
print("hello world")
$
```

I’m running it from shortcuts in extension, I have it configured this way:
![IMG_1360](https://user-images.githubusercontent.com/78122/128644101-45ec1d91-6fb5-4275-aab2-0e6f0d4c3155.jpeg)

But when I run the shortcut it fails with the following:
```
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'python3_ios'
sys.base_prefix = '/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library'
sys.base_exec_prefix = '/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library'
sys.platlibdir = 'lib'
sys.executable = '(null)/bin/python3'
sys.prefix = '/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library'
sys.exec_prefix = '/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library'
sys.path = [
'/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library/lib/python39.zip',
'/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library/lib/python3.9',
'/Users/holzschu/src/Xcode_iPad/a-Shell/cpython/Library/lib/lib-dynload',
]
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000000016b16b000 (most recent call first):

```

I’m able to run `python —version` though, which makes me think is not a path or linking issue. I also don’t know if the `Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding` is the actual error, or just an error when python is trying to dump a bunch of debug info (it does look like the latter though).

The script run totally fine within the a-shell app:
```
$ cd $SHORTCUTS
$ python ./simple.py
hello world
$
```

Any clues or thoughts on this?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.