Comments (20)
This is likely because you're modifying sys.path
as part your script, so stickytape won't be able to find youtube_dl
(assuming it's not otherwise on your Python path). As a general rule in Python programming, I'd suggest avoid directly manipulating sys.path
in a script. Stickytape supports adding specific paths to the Python path using the --add-python-path
argument, as documented in the README.
from stickytape.
I think I have given you all the info needed to reproduce it. Could you please tell me what you are missing?
I don't think you've shared the code that you're trying to use stickytape on. If you could share that code, and the command you're using, then that would help.
from stickytape.
Could you post the code that you're using? You posted some code in the original issue, but later said that you'd changed it, so I don't know what code you're using now. Also, could you post the command you're using?
from stickytape.
It looks like there's a few different imports in youtube-dl that stickytape doesn't handle correctly. I'll take a look at fixing them if I get a chance, but I don't know when that will be.
from stickytape.
This is just a spare time project for me, so I wouldn't hold your breath! Depending on your use-case, you might well be better off using something else: for instance, using PyInstaller, or using the single-file youtube-dl download.
from stickytape.
The latest version of stickytape resolves at least some of the issues in using youtube-dl. I haven't tried your specific example though.
from stickytape.
@mwilliamson Thanks. I changed to that. (Maybe mention this in the docs?)
Now I get much more complicated errors. I think I will look at them and see if I understand anything. And probably file a new bug report.
(If you prefer I can give more detailed instructions here. So you do not have to wait for my probably slow analysis.)
from stickytape.
Closing for now, but feel free to reopen if you find any issues.
from stickytape.
Thanks, but please reopen. I can't get this to work. (I did send you a mail message a few days ago where I told you this and asked for some help.)
from stickytape.
Could you describe the problem you're having?
from stickytape.
As I said I normally do not explicitly use python. So my setup of python might be broken. I really do not know.
To investigate this I switched from using Windows 10 cmd shell to the Ubuntu subsystem that now comes with Windows 10. I normally do not use Ubuntu (or any Linux-variant) so I struggled a bit with the setup again. After consulting my friend Internet I think I finally got the setup complete by using
sudo apt-get update
and sudo apt-get dist-upgrade
A surprisingly 300 MB update.
After moving from __future__ import unicode_literals
to the top of the stickytape output I now get the error below. (There may be something wrong with PYTHONPATH. I get a bit lost here.)
`# python b.py
Traceback (most recent call last):
File "/tmp/tmpqc6wj4gm/youtube_dl/extractor/init.py", line 4, in
from future import unicode_literals
ModuleNotFoundError: No module named 'youtube_dl.extractor.lazy_extractors'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "b.py", line 1640, in
import youtube_dl
File "/tmp/tmpqc6wj4gm/youtube_dl/init.py", line 43, in
from .extractor import gen_extractors, list_extractors
File "/tmp/tmpqc6wj4gm/youtube_dl/extractor/init.py", line 9, in
import io
File "/tmp/tmpqc6wj4gm/youtube_dl/extractor/extractors.py", line 4, in
ModuleNotFoundError: No module named 'youtube_dl.extractor.abc'`
from stickytape.
I'm afraid I can't help without being able to see the source code, or other ways of reproducing the error. If you could provide minimal reproduction steps, then I'll take a look if I get a chance.
from stickytape.
I think I have given you all the info needed to reproduce it. Could you please tell me what you are missing?
from stickytape.
The code I want to use stickytape on is in the repository below. (With the small addition I mentioned in the beginning.)
https://github.com/ytdl-org/youtube-dl
from stickytape.
youtube-dl/youtube_dl/mytest.py:
##### Copied from __main__.py
from __future__ import unicode_literals
import sys
import youtube_dl
if __name__ == '__main__':
print()
print(f"Arguments count: {len(sys.argv)}")
for i, arg in enumerate(sys.argv):
print(f"Argument {i:>6}: {arg}")
sys.argv = [sys.argv[0], "-g", "https://www.youtube.com/watch?v=N5xyr1_DhpA" ]
youtube_dl.main()
In youtube_dl:
stickytape mytest.py --add-python-path .. --output-file b.py
from stickytape.
Please reopen. This is a blocking issue for me.
from stickytape.
It looks like there's a few different imports in youtube-dl that stickytape doesn't handle correctly. I'll take a look at fixing them if I get a chance, but I don't know when that will be.
That sounds very good. It looks a bit complicated.
I am trying to help to solve some accessibility issues with this. It has been on my to-do list for long. And I hoped that this could be a way. So I am looking forward to your replies.
from stickytape.
I need a single python file. And it should be as small as possible. I don't believe there is something like it from youtube-dl. (I need to import this to Brython.)
If you have some thoughts about what goes wrong I can perhaps look into it.
from stickytape.
Thanks, that sounds very nice. I will have a look as soon as I can.
from stickytape.
Many thanks! I took a deep breath, updated python to 3.9, updated stickytape. It did not work in Windows 10 cmd shell.
Took a much deeper breath, updated Windows WSL, updated Ubuntu for WSL to 21.04, updated its python to 3.9, etc.
The output file worked (in Ubuntu bash).
This was a very essential step in what I am trying to do. Now over to the people at Brython to get some advice there.
from stickytape.
Related Issues (20)
- Library to script conversion possible? HOT 4
- Dynamic imports don't work if the python path is a level up from their location HOT 2
- PermissionError: [WinError 5] Access is denied Error in Windows environment HOT 3
- How to "make" HOT 2
- Holding of the __init__.py during 'make_package' cause failure on exit (Windows + IronPython)
- Using sticky tape to pass code to external engine HOT 1
- from __future__ import unicode_literals HOT 12
- Relative imports matching stdlib modules are incorrectly ignored HOT 1
- Improve list of stdlib modules
- Handle relative imports from parent packages HOT 1
- UnicodeEncodeError: 'charmap' codec can't encode characters in position 83853-83854 HOT 13
- Relative import still doesn't work? HOT 4
- SyntaxError: Non-UTF-8 code starting with '\xff' HOT 1
- How to include Python standard library HOT 1
- Renaming of modules HOT 4
- Explicitly add modules inline HOT 1
- Move future statements at the top HOT 2
- how to convert many py files to a py file without make tempfile HOT 1
- when i exec a cmpiled file in a cmpiled file ,raise NameError: global name '__stickytape_working_dir' is not defined HOT 4
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 stickytape.