You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Debian GNU/Linux 12 (FROM python:3.9-slim-buster), and have xclip installed.
However, in my streamlit app, I'm still getting the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/pyperclip/__init__.py", line 659, in lazy_load_stub_copy
return copy(text)
File "/usr/local/lib/python3.9/site-packages/pyperclip/__init__.py", line 336, in __call__
raise PyperclipException(EXCEPT_MSG)
pyperclip.PyperclipException:
Pyperclip could not find a copy/paste mechanism for your system.
For more information, please visit https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error
I'm using pyperclip==1.8.2
My dockerfile:
# Use an official Python runtime as a base imageFROM python:3.9-slim-buster
# Set the working directory in the containerWORKDIR /app
# Install system dependenciesRUN apt-get update \
&& apt-get install -y git xclip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements.txt file into the containerCOPY requirements.txt .
# Install Python dependenciesRUN pip3 install -r requirements.txt
# Copy the app files into the containerCOPY bridge_rna_designer/ ./bridge_rna_designer/
COPY .streamlit/ ./.streamlit/
COPY img/ ./img/
COPY app.py ./
# Make port ${PORT} available to the world outside this containerEXPOSE ${PORT}
# Run the app when the container launchesCMD sh -c "streamlit run app.py \ --server.headless true \ --server.fileWatcherType none \ --browser.gatherUsageStats false \ --server.port=${PORT} \ --server.address=0.0.0.0"
I had a similar issue the other day when using pyperclip in GitHub Actions. The issue was solved by using Xvfb. If my understanding is correct, while xclip and the other copy/paste mechanisms provide the ability to copy and paste from the clipboard, the clipboard itself is provided by X, which Xvfb emulates. In my case the solution was something like this:
I'm using
Debian GNU/Linux 12
(FROM python:3.9-slim-buster
), and have xclip installed.However, in my streamlit app, I'm still getting the error:
I'm using
pyperclip==1.8.2
My dockerfile:
My requirements.txt file:
The relevant streamlit code is basically the same at shown in https://discuss.streamlit.io/t/how-to-add-copy-to-clipboard-button-to-text-area/49648/2.
The text was updated successfully, but these errors were encountered: