0

everyone. I would like to ask for some help with a problem I have been struggling with without any progress. I am creating a small project in my free time. A part of the project is a Python script that downloads a whole Youtube music playlist with pytube and then converts it to audio files with moviepy. When I run the script in PyCharm or in PyCharm's terminal, it works just fine. However, when I try to run it from the command prompt, it returns this exception:

Traceback (most recent call last): File "C:\Users\denis\Desktop\Programming\youtube_music_extraction\audio_from_ytvideos.py", line 41, in download_playlist(playlist_link, destination_folder) File "C:\Users\denis\Desktop\Programming\youtube_music_extraction\audio_from_ytvideos.py", line 30, in download_playlist for v in video_urls: File "C:\Users\denis\anaconda3\lib\site-packages\pytube\helpers.py", line 71, in iter curr_item = self[iter_index] File "C:\Users\denis\anaconda3\lib\site-packages\pytube\helpers.py", line 57, in getitem next_item = next(self.gen) File "C:\Users\denis\anaconda3\lib\site-packages\pytube\contrib\playlist.py", line 281, in url_generator for page in self._paginate(): File "C:\Users\denis\anaconda3\lib\site-packages\pytube\contrib\playlist.py", line 118, in _paginate json.dumps(extract.initial_data(self.html)) File "C:\Users\denis\anaconda3\lib\site-packages\pytube\contrib\playlist.py", line 58, in html self._html = request.get(self.playlist_url) File "C:\Users\denis\anaconda3\lib\site-packages\pytube\request.py", line 53, in get response = _execute_request(url, headers=extra_headers, timeout=timeout) File "C:\Users\denis\anaconda3\lib\site-packages\pytube\request.py", line 37, in _execute_request return urlopen(request, timeout=timeout) # nosec File "C:\Users\denis\anaconda3\lib\urllib\request.py", line 214, in urlopen return opener.open(url, data, timeout) File "C:\Users\denis\anaconda3\lib\urllib\request.py", line 517, in open response = self._open(req, data) File "C:\Users\denis\anaconda3\lib\urllib\request.py", line 539, in _open return self._call_chain(self.handle_open, 'unknown', File "C:\Users\denis\anaconda3\lib\urllib\request.py", line 494, in _call_chain result = func(*args) File "C:\Users\denis\anaconda3\lib\urllib\request.py", line 1417, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError:

I must be able to run the script from the command line, because it will be executed by a C# WPF app. So far I have: -Made sure that I am using the same interpreted in PyCharm and in the command line; -Tried installing OpenSSL in various different ways: using pip, using an installer from their website; Nothing has worked so far. I will be incredibly grateful if someone could help me resolve the problem and understand what causes it, so I can become a better programmer. Thanks in advance!

0 Answers0