Why the new version of Raycast script cannot send text to clipboard?
baker221 opened this issue · comments
I write a Python script of OCR.
The beginning part of script:
#!/usr/bin/env python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title ocr
# @raycast.mode silent
# Optional parameters:
# @raycast.icon
The clipboard operation part:
import pyperclip
pyperclip.copy(content)
print("Success!")
In the old version, this works well. But now (version 1.51.3) after running it, the clipboard is still empty.
But when I run it in console, this works well.
The bash command of pbcopy
or something cannot operate correctly now
This is weird, in this version of Raycast, if the content is Chinese, it cannot work. But if I use this script in terminal, both can work well.
# pyperclip.copy("你好") # not work
pyperclip.copy("hello") # work
print("Success!")
I also test the following:
import pyperclip
pyperclip.copy(content)
print(pyperclip.paste())
The output is empty if the content has Chinese.
But if I just print it:
print("你好")
This can work and display.
I write a new simple script and I am confirmed that this is the problem of new version Raycast.
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title mytest
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 📋
# Documentation:
# @raycast.description hello
#echo "haha" | pbcopy # works
echo "你好" | pbcopy # do not work
echo "Clipboard emptied"
same problem for me
Thank you for writing and sorry this took long to answer. I just tried your script and everything works as expected (see below).
It looks like it has something to do with the terminal environment. Can you think of anyway I can replicate?
I see that the "character" is 3. But "你好" just have 2 characters. If I copy "你好" directly, the character is 2. (But even if I added a space before this string, the script still cannot work)
same problem
This issue/pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean. Thanks for your contributions.
Do you have any idea solving this issue until now? This version (1.54.1) still cannot work.
This issue/pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean. Thanks for your contributions.
Still no solution? @dehesa
Still no solution? @dehesa
I found that. The Raycast's locale somehow changed in a new version.
Change the pbcopy
into below:
echo "你好" | LANG=zh_CN.UTF-8 pbcopy
This issue/pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 7 days to keep our backlog clean. Thanks for your contributions.