question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] ImportError: cannot import name urlencode

See original GitHub issue

I just installed the newes python and pytube, still pytube isn´t working at all. I just started with python (i know c++ so i get the basics (i hope)) Am i just too bad using python?

Describe the bug Using this in python cmd: pytube https://youtube.com/watch?v=2lAe1cqCOXo I get: SyntaxError: invalid syntax

using the same line on Linux i get: ImportError: cannot import name urlencode

using this: from pytube import YouTube yt = YouTube("https://youtu.be/U16Xg_rQZkA") print(ty.title) stream = yt.streams.first() stream.download() nothing happends and cmd just closes

using this: from pytube import YouTube YouTube('https://www.youtube.com/watch?v=-TEGPelS3Ac').streams.first().download() the same happens

System information Please provide the following information: newest python version newest pytube version win 10/ Ubuntu

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
Trollportcommented, Apr 1, 2021

thank you! finally works 😃

1reaction
tfdahlincommented, Mar 8, 2021

yes, pytube https://www.youtube.com/watch?v=U16Xg_rQZkA belongs in the normal win cmd, however it will require you to have your PATH set up correctly. When you installed python, did you use an installer from python.org? Part of their installation process asks you if you want to set the PATH variable, and if you didn’t check that box, you’ll need to set your PATH variable manually. It’s kind of annoying to do that though, so you might try re-installing python and making sure to check that box during the installation

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'urlencode' when trying to install flask.ext ...
The urllib module has been split into parts and renamed in Python 3 to urllib.request, urllib.parse, and urllib.error.
Read more >
Fixing ImportError: cannot import name 'urlencode' in Python3
Solution: As described by Fred Foo here on StackOverflow, Python3 contains urlencode() not in the urllib module but in urllib. parse .
Read more >
ImportError: cannot import name urlencode · Issue #2264
I am running Python 2.7.8. I get the following error from import requests: Traceback (most recent call last): File "request_get.py", line 1, ...
Read more >
cannot import name 'urlencode' when trying to install flask.ext ...
Coding example for the question ImportError: cannot import name 'urlencode' when trying to install flask.ext.storage.
Read more >
pypodio2 import does not work in python3? - Podio Help Centre
Hi, I'm struggling with Podio API and running it in python 3.9. ... ImportError: cannot import name 'urlencode' from 'urllib'. The error ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found