Output file still want to import files
See original GitHub issuePlease notice that I do not normally use python! So I do not know the import system at all.
I tried to make a single python file for a youtube-dl case:
`stickytape %mypar%/youtube_dl/mytest.py --add-python-path . --output-file st-temp.py`
The output file works in the same directory where it is written. But it still imports other files (which I to my surprise noticed when I tried to move it).
The file mytest.py looks like this (this file is mostly just copied from main.py):
from future import unicode_literals
import sys
import os.path path = os.path.realpath(os.path.abspath(file)) sys.path.insert(0, os.path.dirname(os.path.dirname(path)))
import youtube_dl
if name == ‘main’: sys.argv = [sys.argv[0], “-g”, “https://www.youtube.com/watch?v=N5xyr1_DhpA” ] youtube_dl.main()
It is import youtube-dl
that is the still there. (And that is of course just a start of the imports I want to avoid.)
(There is another problem too. The from __future__ import unicode_literals
does not work. Moving it to the top of the output file fixes this problem.)
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (9 by maintainers)
The latest version of stickytape resolves at least some of the issues in using youtube-dl. I haven’t tried your specific example though.
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.