Pardon me if this is slightly off-topic but I need help.
I am trying to get my python script to to work in a linux terminal by grabbing the output such that the output results ‘overwrites’ the copy command (ctrl+c).
Currently while I am able to get this to work by opening a maya session but as soon as I tried running python run_script.py
in the terminal console, I got the following error:
QApplication: Must construct a QApplication before accessing a QClipboard
Traceback (most recent call last):
File "get_pending_status_files_modi.py", line 10, in <module>
cb.clear(mode=cb.Clipboard )
AttributeError: 'NoneType' object has no attribute 'clear'
This is the code of my script:
def main():
data_list = ['this-is-a-test', 'for-learning', 'purposes-only']
connect_result = '|'.join(data_list)
output = '{0}{1}{2}'.format('(', connect_result, ')')
print output
cb.setText(output, mode=cb.Clipboard)
main()
Though this is a small example, but I am using this for large amount of values in the data_list, and hence I want to know if there are any other ways that I can make use of?
By the way, I am unable to install any other libraries as I am using my office’s computer but I am in linux env, some of the methods online, using of xsel
, xclip
or pyperclip
does not work for me, unfortunately…