Comments (7)
From Apple's point of view, the extension and the app are two different apps, with different downloads and directories. The extension does not have access to what has been installed in the app, the app cannot access the extension main directory. Both have access to a shared directory, which is where the extension runs by default (it's ~shortcuts
or $GROUP
).
To answer your main question: you need to install packages in a place where the extension can access them, ~shortcuts/Library/lib/python3.11/site-packages
.
To do this:
- either copy
~/Library/lib/python3.11
to~shortcuts/Library/lib/python3.11
(pro: fast and easy, con: you might be copying a lot of packages you don't need), or: - set the environment variable
PYTHONUSERBASE
to~shortcuts/Library
, then re-install the packages you need.
When the extension runs, it uses the Python packages in ~shortcuts/Library
.
from a-shell.
Ok, seems simple enough. Do you know if it is possible in iOS to make a symlink so I don't have to keep copying files over?
from a-shell.
Symlinks won't work over different apps (for security reasons), hard links will work (use ln
instead of ln -s
) but you can only hard link files, not directories. However, if you don't want to keep copying files over, you can set PYTHONUSERBASE
to ~shortcuts/Library
in the app (using the .profile
or .bashrc
files) and have both the app and the extension access the same shared directory.
from a-shell.
Symlinks won't work over different apps (for security reasons), hard links will work (use
ln
instead ofln -s
) but you can only hard link files, not directories. However, if you don't want to keep copying files over, you can setPYTHONUSERBASE
to~shortcuts/Library
in the app (using the.profile
or.bashrc
files) and have both the app and the extension access the same shared directory.
Ok, I added export PYTHONUSERBASE= ~shortcuts/Library
to my .profile and restarted a-Shell then reinstalled yt-dlp but now when I run the shortcut it says "problem communicating with the app".
from a-shell.
In-extension Shortcuts have a hard time limit of 5 seconds (enforced by the system). "There was a problem communicating with the app" usually means: the Shortcut went over the time limit, and the system terminated it (it could also mean that the shortcut went over the memory limit or the CPU usage limit, but the time limit is much more likely).
You can also run yt-dlp
inside the app, then call the command open shortcuts://
to go back to the shortcut and execute more actions. There are already several shortcuts running yt-dlp
that use this trick.
from a-shell.
In-extension Shortcuts have a hard time limit of 5 seconds (enforced by the system). "There was a problem communicating with the app" usually means: the Shortcut went over the time limit, and the system terminated it (it could also mean that the shortcut went over the memory limit or the CPU usage limit, but the time limit is much more likely).
It's not the time limit because I get that error after about half a second.
Also, I can't run the command in the app because I need this shortcut to run as an automation, completely in the background.
from a-shell.
@holzschu Setting the python userbase path is not helpful. Many shortcuts need to access different folders at different times, both in extension mode and in app mode in the same shortcut. A more efficient and simple way would be to add to the a-shell shortcuts commands the option to explicitly set the folder where do you want to execute the action or load/save a file. If the folder has not been authorized by the user yet, you can explicitly ask for permissions to the user the first time a certain folder is asked access. Can you do it?
from a-shell.
Related Issues (20)
- YouTube is broken in internalbrowser HOT 7
- Pasting to terminal strips out line breaks. Intended? HOT 2
- Support for loop operators HOT 1
- Tlmgr Update error with a-Shell on Ipad Pro HOT 14
- Codemirror not saving changes HOT 2
- Can a-shell use Python packages built for Mac? HOT 2
- shortcut can't import python package
- telnet without arguments buffers its output until `open` establishes a connection or program exits HOT 2
- Setting to allow swipe to scroll, instead of go through history HOT 4
- ssh-copy-id fails with redirect error HOT 4
- djls
- Lua libraries
- wasi preopens? HOT 2
- Is there a way to make the PTY work in Python? HOT 1
- Any progress in adding support for Python packages with Rust dependencies?
- Lib proposition: cvxpy HOT 1
- request PROLOG language support
- How to enable developer mode on IOS 17.5 by a-Shell HOT 14
- about lg2's proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from a-shell.