Description
With the latest version of pandas installed on windows, running the following code will raise an error:
df = pd.DataFrame(['\x00'])
df.to_clipboard(index=False, excel=False)
Here is the traceback:
ArgumentError Traceback (most recent call last)
in
1 df = pd.DataFrame(['\x00'])
----> 2 df.to_clipboard(index=False, excel=False)
e:\Anaconda\lib\site-packages\pandas\core\generic.py in to_clipboard(self, excel, sep, **kwargs)
3023 from pandas.io import clipboards
3024
-> 3025 clipboards.to_clipboard(self, excel=excel, sep=sep, **kwargs)
3026
3027 @Final
e:\Anaconda\lib\site-packages\pandas\io\clipboards.py in to_clipboard(obj, excel, sep, **kwargs)
143 else:
144 objstr = str(obj)
--> 145 clipboard_set(objstr)
e:\Anaconda\lib\site-packages\pandas\io\clipboard_init_.py in lazy_load_stub_copy(text)
631 global copy, paste
632 copy, paste = determine_clipboard()
--> 633 return copy(text)
634
635
e:\Anaconda\lib\site-packages\pandas\io\clipboard_init_.py in copy_windows(text)
454 # the object must have been allocated using the
455 # function with the GMEM_MOVEABLE flag.
--> 456 count = wcslen(text) + 1
457 handle = safeGlobalAlloc(GMEM_MOVEABLE, count * sizeof(c_wchar))
458 locked_handle = safeGlobalLock(handle)
e:\Anaconda\lib\site-packages\pandas\io\clipboard_init_.py in call(self, *args)
306
307 def call(self, *args):
--> 308 ret = self.f(*args)
309 if not ret and get_errno():
310 raise PyperclipWindowsException("Error calling " + self.f.name)
ArgumentError: argument 1: <class 'ValueError'>: embedded null character