2

When i run this code

import pyperclip
pyperclip.copy('German')
pyperclip.paste()

I get the error

Traceback (most recent call last):
  File "C:/Windows/System32/pyperclip.py", line 1, in <module>
    import pyperclip
  File "C:/Windows/System32\pyperclip.py", line 2, in <module>
    pyperclip.copy('German')
AttributeError: module 'pyperclip' has no attribute 'copy'

I have installed pyperclip using pip I have tried reinstalling Pyperclip but it does nothing.

Franco Schwan
  • 29
  • 1
  • 4
  • 1
    You've named your own script `pyperclip.py`, so *that* is what you're importing. Also, why on earth are your scripts in `System32`? – jonrsharpe Oct 26 '15 at 08:13

4 Answers4

6

You called your module pyperclip by naming your file pyperclip.py. Therefore, your import pyperclip is actually a recursive import (importing your own module) and will not work.

To avoid this, just don't name your module the same as a library you use.

nneonneo
  • 171,345
  • 36
  • 312
  • 383
0

instead of pyperclip I have decided to use os:

os.system("echo '%s' | pbcopy" % STRING_NAME_HERE
CDspace
  • 2,639
  • 18
  • 30
  • 36
Mateusz k
  • 1
  • 1
0

I recommend start reading @nneonneo answer first and if the below solutions did not fix the problem, try this one:

  • In the same directory I noticed that I have paperclip.py file. I just renamed it and it stopped showing circular import error
-1

Firstly, Have you install pyper clip module or not. if you have not install pyperclip module then it will not work