4

I'm new to python and i'm trying to install win32clipboard to be able to use this code:

import win32clipboard
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardText('testing 123')
win32clipboard.CloseClipboard()

# get clipboard data
win32clipboard.OpenClipboard()
data = win32clipboard.GetClipboardData()
win32clipboard.CloseClipboard()
print data
raw_input()

How do i exactly install the necessary module to be able to do so? I'm using python version 2.72.

user2151341
  • 47
  • 2
  • 3
  • 5

2 Answers2

14

This module is part of pywin32 module.

To install:

  1. Go to http://sourceforge.net/projects/pywin32/files/pywin32/
  2. Choose the latest build, e.g.: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
  3. Download the installer for your system, e.g.: pywin32-219.win-amd64-py2.7.exe
  4. Run the installer.
  5. Use the Python you've installed it for to run your win32clipboard script.
Cees Timmerman
  • 17,623
  • 11
  • 91
  • 124
Igonato
  • 10,175
  • 3
  • 35
  • 64
  • Dude i know that, what i don't know how to do is install it, i want to be able to use that code. That link you gave me has not helped a single bit, they are just a bunch of files many of which i don't need. I need a step by step how to install it. Running windows 7 x86. – user2151341 Mar 09 '13 at 12:05
  • [Direct link](http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download) to the file you need. Just install it and code above will work. – Igonato Mar 09 '13 at 13:32
  • 3
    Latest releases are now here: https://github.com/mhammond/pywin32/releases – zeflex Nov 21 '18 at 21:22
12

For those still here 7 years later

run this in your shell or cmd (assuming you added python to PATH, otherwise do that first)

pip install pywin32
saster1111
  • 121
  • 1
  • 3