Questions tagged [pyperclip]

A cross-platform clipboard module for Python.

Pyperclip is a cross-platform Python module for copy and paste clipboard functions. It works with Python 2 and 3.

More information:

191 questions
0
votes
1 answer

Copy strings in pyperclip

Hey everyone this code doesn't work for me: import pyperclip as clip string="blah blah" clip.copy(string) clip.paste(string) the error: TypeError: init_windows_clipboard..paste_windows() takes 0 positional arguments but 1 was given THANKS
Arian
  • 57
  • 9
0
votes
0 answers

Why is the pasted filepath missing the drive letter?

I'm trying to use Python to paste a filepath string into Excel. Specifically I'm pasting into the "File name:" section of the file explorer after using Save As. Below is the section of code I used to paste the filepath and save the file. # TODO…
0
votes
1 answer

How to use pytest with pyclip inside a tox python env?

I'm using Pyperclip to put something into the clipboard and testing it with Pytest. I'm using GitHub actions for CI/CD that runs tox. Running pytest on my local system works just fine, but doing the same in tox fails because of the following display…
0
votes
1 answer

Pyperclip module not Printing from paste() method

I am using python 3.8.10 on Ubuntu 20.04 and successfully installed pyperclip. I wanted to run a basic test using this code: import pyperclip pyperclip.copy("testing") pyperclip.paste() At first, I was getting the error: Traceback (most recent call…
0
votes
0 answers

Python if Statement doesn't meet condition but it appears to meet the condition

I don't understand why my if statement doesn't work. a = "one" if a == "one": print(a) elif a == "two": print(a) elif a == "three": print(a) The above works correctly but, when I use this code to copy an excel cell that equals one…
0
votes
1 answer

python .write is making unwanted spaces between lines

I'm running into a problem in python about writing files as txt files from clipboard. I'm using pyperclip.paste() to get the data from clipboard and write the file. But when I use .write command in Python to create a .txt file, the text file has…
0
votes
1 answer

AttributeError: module 'Foundation' has no attribute 'NSString' error with pyperclip

Question - How do I fix my code so I don't get this error? I'd like output to be placed in my clipboard buffer (I'm on a Mac)? What I've tried - Printing output to the console works great! I've tried uninstalling and reinstalling via pip…
0
votes
0 answers

How to paste a list in a specifif spot of an Excel sheet?

I am trying to copy a list in a specific spot of an Excel file, and I want it line by line. I am not sure where to start. Any ideas? import pyperclip # this makes the list from a txt file. blof = open("blacklist_list.txt", "r") list_of_sn = [] for…
0
votes
1 answer

Tkinter - Copy to clipboard via bind (Control+c shortcut): Clipboard is empty when closing program, but via tkinter context menu everything is normal

In a custom entry, I have a context menu, with the function copy the selected text, which is performed by pyperclip. When executing the 'copy_to_clipboard' function from the context menu, everything works fine... The selected text is copied to…
Mrkalvin Bs
  • 103
  • 2
  • 9
0
votes
3 answers

ModuleNotFoundError: No module named 'pyperclip' in Visual Studio Code

I've installed pyperclip and it works fine in python IDLE yet when I try to open the same program in vscode I get : ModuleNotFoundError: No module named 'pyperclip'. I'm on Python 3.10.0 and pyperclip is version 1.8.2 This is the program that I'm…
0
votes
1 answer

how can I observe a change in a python var

Hi I'm trying to catch the change in the paperclip of my computer with the library pyperclip something same as url=pyperclip.paste() I want to create a thread which can append all the urls into a list my script, but I don't know how to could I do…
WhiteAB
  • 162
  • 3
  • 11
0
votes
0 answers

Module Not Found error : no module named 'pyperclip'

Tryin to install pyperclip into python Using Mac 11.2.2(20D80) VScode Tried pip install pyperclip pip3 install pyperclip sudo pip install pyperclip made virtual space and tried above Saids "Requirement already satisfied: pyperclip in…
0
votes
1 answer

pyperclip.copy(str(line)) not copying properly

Im trying to get paths in a list.txt, one per line, then copy a line and paste in a program prompt, but it keeps me saying "file not found", if I paste the copied line in a notepad, then copy/paste with the mouse the text in notepad into the prompt…
rafael
  • 11
  • 3
0
votes
1 answer

How to save url using xdotool ctrl+c data in python list in linux

I started with following code def getclip(self): xdo = Xdo() key = "ctrl+c" xdo.send_keysequence_window(0, key.encode()) now i wish to print the data in clipboard(literally - not the python module) in python console how can I achieve that?
qagourab
  • 11
  • 4
0
votes
0 answers

Is there a way to copy a string to clipboard that works on any operating system/device?

Goal: copy a string to clipboard using Python on Android Linux 11 I tried pyperclip but it doesn't work on Linux yet. import pyperclip pyperclip.copy("Hello World") Error: Traceback (most recent call last): File…
adzhanoev
  • 26
  • 1
  • 5