-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'str' object has no attribute '_MEIPASS' #5797
Comments
This looks like the Are you assigning a string to a variable called This seems to be reproducer and it seems to affect only frozen application: # sys='whatever' # uncomment to reproduce the problem
import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')
print(pyperclip.paste()) |
@rokm Thanks mate! |
This is still a bug? That
... where it certainly doesn't belong. |
Yeah, this specific problem (overwriting The bootstrap script should be just a script, without any functions or classes that can be called or instantiated after the script itself has finished. |
The test attempts to trigger an error in PyInstaller's ctypes.CDLL() wrapper, by using sys and os as string variables in the global namespace.
Move the ctypes hooks from bootstrap script into separate module (pymod04_ctypes). The main motivation for this is to prevent the modifications to global namespace from affecting the hook ctypes hooks code; speficially, if user decides to use `sys` or `os` as variables in the global namespace, that should not effect the ctype hook function _frozen_name(), which treats `sys` and `os` as names modules (which were bound to those names when the bootstrap script was executing). Fixes pyinstaller#5797. This commit is a cleaned-up and modernized version of an earlier commit from pyinstaller#3038 (daf60a6). Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Move the ctypes hooks from bootstrap script into separate module (pymod04_ctypes). The main motivation for this is to prevent the modifications to global namespace from affecting the ctypes hooks code; specifically, if user decides to use `sys` or `os` as variables in the global namespace, that should not effect the ctype hook function _frozen_name(), which treats `sys` and `os` as names of modules (which were bound to those names when the bootstrap script was executed). Fixes pyinstaller#5797. This commit is a cleaned-up and modernized version of an earlier commit from pyinstaller#3038 (daf60a6). Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Move the ctypes hooks from bootstrap script into separate module (pymod04_ctypes). The main motivation for this is to prevent the modifications to global namespace from affecting the ctypes hooks code. Specifically, if user decides to use `sys` or `os` as variables in the global namespace, that should not effect the ctypes hook function _frozen_name(), which treats `sys` and `os` as names of modules (which were bound to those names when the bootstrap script was executed). Fixes pyinstaller#5797. This commit is a cleaned-up and modernized version of corresponding commit from pyinstaller#3038 (daf60a6). Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Move the ctypes hooks from bootstrap script into separate module (pymod04_ctypes). The main motivation for this is to prevent the modifications to global namespace from affecting the ctypes hooks code. Specifically, if user decides to use `sys` or `os` as variables in the global namespace, that should not effect the ctypes hook function _frozen_name(), which treats `sys` and `os` as names of modules (which were bound to those names when the bootstrap script was executed). Fixes pyinstaller#5797. This commit is a cleaned-up and modernized version of corresponding commit from pyinstaller#3038 (daf60a6). Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
The test attempts to trigger an error in PyInstaller's ctypes.CDLL() wrapper, by using sys and os as string variables in the global namespace.
Move the ctypes hooks from bootstrap script into separate module (pymod04_ctypes). The main motivation for this is to prevent the modifications to global namespace from affecting the ctypes hooks code. Specifically, if user decides to use `sys` or `os` as variables in the global namespace, that should not effect the ctypes hook function _frozen_name(), which treats `sys` and `os` as names of modules (which were bound to those names when the bootstrap script was executed). Fixes #5797. This commit is a cleaned-up and modernized version of corresponding commit from #3038 (daf60a6). Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
Description of the issue
I've used pyinstaller to convert my py to exe. App is working fine, all of the features are working ok except "pyperclip.copy".
Even I have no issue with "pyperclip.paste", only copying to clipboard.
Context information (for bug reports)
Whenever I use the command "pyperclip.copy(copy_clipboard)" to copy string to clipboard, it doesn't work instead I get following error:
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter_init_.py", line 1884, in call
File "xxxxx.py", line 5107, in ctrl_c
File "pyperclip_init_.py", line 658, in lazy_load_stub_copy
File "pyperclip_init_.py", line 541, in determine_clipboard
File "pyperclip_init_.py", line 371, in init_windows_clipboard
File "PyInstaller\loader\pyiboot01_bootstrap.py", line 142, in init
File "PyInstaller\loader\pyiboot01_bootstrap.py", line 128, in _frozen_name
AttributeError: 'str' object has no attribute '_MEIPASS'
Output of
pyinstaller --version
:4.3
Version of Python: 3.9.1
Platform: Windows 10
Did you also try this on another platform? No
try the latest development version, using the following command: I've tried but it failed to create exe file.
I've tried all suggested workarounds but couldn't fix this issue. I'm not an advanced programmer so it might be silly issue although I appreciate any help in this regard. Thanks!
The text was updated successfully, but these errors were encountered: