So, if you had installed Python to C: Python, the default library would reside in C: Python Lib and third-party modules should be stored in C: Python Lib site-packages. To completely override sys.path, create a.pth file with the same name as the DLL ( python37.pth ) or the executable ( python.pth ) and specify one line for each path to. The Python Wiki. Welcome to the Python Wiki, a user-editable compendium of knowledge based around the Python programming language. Some pages are protected against casual editing - see WikiEditingGuidelines for more information about editing content. Python is a great object-oriented, interpreted, and interactive programming language. It is often compared (favorably of course ) to Lisp. The Python interpreter is easily extended with new functions and data types implemented in C or C (or other languages callable from C). Python is also suitable as an extension language for customizable applications. This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.
Complete the steps described in the rest of this page to create a simple Pythoncommand-line application that makes requests to the Drive API.
Prerequisites
To run this quickstart, you'll need:
- Python 2.6 or greater
- The pip package management tool
- A Google account with Google Drive enabled
Step 1: Turn on the Drive API
Click this button to create a new Cloud Platform project and automaticallyenable the Drive API:
In resulting dialog click DOWNLOAD CLIENT CONFIGURATION and save the filecredentials.json
to your working directory.Step 2: Install the Google Client Library
Run the following command to install the library using pip:
See the library's installationpage for the alternativeinstallation options.
Step 3: Set up the sample
Create a file named quickstart.py
in your working directory and copy in thefollowing code:
Step 4: Run the sample
Run the sample using the following command:
The sample will attempt to open a new window or tab in your defaultbrowser. If this fails, copy the URL from the console and manually open it inyour browser.
If you are not already logged into your Google account, you will beprompted to log in. If you are logged into multiple Google accounts, you willbe asked to select one account to use for the authorization.
- Click the Accept button.
- The sample will proceed automatically, and you may close the window/tab.
Notes
- Authorization information is stored on the file system, so subsequentexecutions will not prompt for authorization.
- The authorization flow in this example is designed for a command-lineapplication. For information on how to perform authorization in a webapplication, seeUsing OAuth 2.0 for Web Server Applications.
Troubleshooting
This section describes some common issues that you may encounter whileattempting to run this quickstart and suggests possible solutions.
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlparse'
This error can occur in Mac OSX where the default installation of the six
module (a dependency of this library) is loaded before the one that pipinstalled. To fix the issue, add pip's install location to the PYTHONPATH
system environment variable:
Determine pip's install location with the following command:
Add the following line to your
~/.bashrc
file, replacing<pip_install_path>
with the value determined above:Reload your
~/.bashrc
file in any open terminal windows using the followingcommand:
TypeError: sequence item 0: expected str instance, bytes found
Stackoverflow Mobile App
This error is due to a bug in httplib2
, and upgrading to the latest versionshould resolve it:
Cannot uninstall 'six'. It is a distutils installed project...
When running the pip install
command you may receive the following error:
This can happen on Mac OSX when pip attempts to upgrade the six
package thatcame pre-installed. To work around this issue you can add the flag--ignore-installed six
to the pip install
command listed in Step 2.
Stackoverflow Android App
This app isn't verified.
The OAuth consent screen that is presented to the user may show the warning'This app isn't verified' if it is requesting scopes that provide access tosensitive user data. These applications must eventually go through theverification process toremove that warning and other limitations. During the development phase you cancontinue past this warning by clickingAdvanced > Go to {Project Name} (unsafe).
Further reading
Welcome to the Python Wiki, a user-editable compendium of knowledge based around the Python programming language. Some pages are protected against casual editing - see WikiEditingGuidelines for more information about editing content.
Python is a great object-oriented, interpreted, and interactive programming language. It is often compared (favorably of course ) to Lisp, Tcl, Perl, Ruby, C#, Visual Basic, Visual Fox Pro, Scheme or Java... and it's much more fun.
Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems. New built-in modules are easily written in C or C++ (or other languages, depending on the chosen implementation). Python is also usable as an extension language for applications written in other languages that need easy-to-use scripting or automation interfaces.
Getting Started
Links to tutorials, courses and resources | Learning materials, topic guides and links to central resources |
Some common pitfalls of beginners | Books about Python plus reviews |
Questions asked by beginners, answered here | A mixture of introductory and topical material |
Resources written in languages other than English | Different software which runs programs in the Python language |
See also the documentation category for all known documentation-related pages. |
Events, Courses, Conferences, Community
Python Conferences - information about the Python conference scene
Local User Groups - find a Python group near you
Python Training - Python training courses
Python Events - event listing for conferences, training courses and more
Python Event Calendars - calendars for Python conferences and user groups
Participating in the Community - where people using and producing Python get together
Python Software Foundation - show your support by joining the Foundation behind Python
Find a job where you can use Python - Python job boards around the world
Python Software
Information on finding software projects written in Python, including... | Managing your code more effectively |
Ready-to-run applications which use Python | Editing your code more effectively |
Some building blocks for your own projects (including frameworks for database, GUI, Web programming) | How to make others aware of your own works |
Python Core Development Tools
Maintaining the official Python online resources | Roundup and the code review services used by the Python project |
The infrastructure behind Python package hosting | A list of all development process-related resources on this Wiki |
Using this Wiki
This Wiki is a community place to gather and organize all things about Python. Feel free to exercise your editorial skills and expertise to make it a useful knowledge base and up-to-date reference on all Python-related topics.
There are some guidelines describing the policies and rules governing this Wiki and how you can most effectively contribute to it. A list of site improvements describes various tasks where your help would be appreciated. To keep up with changes on this site, check RecentChanges frequently or follow it using RSS: RSS feed.
Creating a Wiki account
In order to sign up for a wiki account, please go to the Create new account form, enter your account name (using the format FirstnameLastname to avoid issues - please don't use spaces in the name) and provide a password, plus email address (for password recovery).
Editing pages
Since spamming and vandalism on this wiki had reached a level that required constant intervention, unfamiliar users are no longer allowed to edit pages. However all you need to do is introduce yourself to the wiki admin group to become an editor.
If you want to edit a page and have just signed up, or find that you can no longer edit a page that you could edit before, please write to the pydotorg-www mailing list describing what you would like to edit, and we'll add you to the EditorsGroup. Please include your account name (wiki name) in this message.
Sorry for any inconvenience, but we want to keep this wiki a useful tool for the community, while at the same time preventing the wiki admins from burning out cleaning up junk.
Reporting problems
In case of emergency, please contact the python.org maintainers, or if experiencing difficulties, contact the pydotorg-www mailing list to say 'help'.
Wiki Attack in January 2013
The wiki was subject to an attack on January 5 2013. Since it was not clear whether user account data was stolen, all passwords were subsequently reset, so you will have to use the password recovery function to get a new password.
See the wiki attack description page for more details. If you find problems, please report them to the pydotorg-www mailing list <pydotorg-www@python.org>.
HTTPS access to the Wiki
We have enabled HTTPS access to the wiki to further enhance security and avoid having to send clear text passwords over the network in order to log in to the wikis.
If you have not been using HTTPS links to the wiki login page, please be advised that your password may have been sniffed on the network at e.g. a conference. It is best to change it and stop using HTTP links to the wiki login page.