Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
2to3
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Imports = Place (the relevant subset of) this block at the beginning of each of your script files: <syntaxhighlight lang="python" style="font-size: 70%"> from __future__ import division from __future__ import print_function from __future__ import absolute_import import sys if sys.version_info[0] < 3: import urllib2 from urllib2 import URLError, HTTPError from urllib import quote from idlelib.TreeWidget import TreeItem, TreeNode from Tkinter import * import Tkinter import tkSimpleDialog import tkFileDialog import tkMessageBox import tkColorChooser import Queue import ttk from StringIO import StringIO else: import urllib.request as urllib2 from urllib.error import URLError, HTTPError from urllib.parse import quote from idlelib.tree import TreeItem, TreeNode from tkinter import * import tkinter as Tkinter from tkinter import simpledialog as tkSimpleDialog from tkinter import filedialog as tkFileDialog import tkinter.messagebox as tkMessageBox import tkinter.colorchooser as tkColorChooser import queue as Queue import tkinter.ttk as ttk from io import StringIO </syntaxhighlight> '''Some important notes:''' * <code>from __future__ import division</code> will change the behavior of integer division, <code>3/2 == 1</code> becomes <code>3/2 == 1.5</code>. Use <code>//</code> if you need [https://python-reference.readthedocs.io/en/latest/docs/operators/floor_division.html floor division] (<code>3//2 == 1</code> in both Python 2 and 3). * <code>io.StringIO</code> is not an exact replacement for <code>StringIO.StringIO</code>, it doesn't accept [https://docs.python.org/3/library/stdtypes.html#bytes bytes] input. You might need <code>io.BytesIO</code> instead.
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
2to3
(section)
Add topic