atbswp is a software that help you automate all the mouse clicks and movements and keyboards keys so you can automate everything u do and repeat it or replay it
and by using crontab you can schedule it so you can run automated sequence at specific time
the app extracts a python file
and you run it inside the app or in terminal without the need of the app
the problem is
when i run it in terminal it runs ok
when i put it in crontab to run it doesnt run and i got errors in the crontab log file
i really need help it is something amazing for everyone i think
this is the cron log error
Traceback (most recent call last):
File "/home/zultan/bot1", line 4, in
import pyautogui
File "/home/zultan/.local/lib/python3.8/site-packages/pyautogui/init.py", line 241, in
import mouseinfo
File "/home/zultan/.local/lib/python3.8/site-packages/mouseinfo/init.py", line 223, in
_display = Display(os.environ['DISPLAY'])
File "/usr/lib/python3.8/os.py", line 675, in getitem
raise KeyError(key) from None
KeyError: 'DISPLAY'
i found the solution for everybody
put this
in the crontab -e
DISPLAY=:0
XAUTHORITY=/run/user/1000/gdm/Xauthority
Related
I have a problem whenever i run my curses application,it always runs fine on windows(thanks to windows-curses module) and other Linux Distros,but since i have Garuda Linux installed i want to run the app on it.but the problem is,whenever i run the app it yields the following error:
Traceback (most recent call last):
File "/home/justaus3r/Desktop/Programming/Python/Projects/ANFU/Anfu.py", line 564, in <module>
curses.wrapper(Main)
File "/usr/lib/python3.9/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "/home/justaus3r/Desktop/Programming/Python/Projects/ANFU/Anfu.py", line 330, in Main
curses.init_pair(69, curses.COLOR_MAGENTA, -1)
_curses.error: init_pair() returned ERR
i have tried it with different terminals like xterm and Alacritty.it throws the same error,does my code has some problems or the module isn't compatible with Garuda Linux.any help is appreciated
I was gettiing same issue in redhat - maipo
this worked for me
export TERM=xterm-256color
Context: I started using OSX about a year ago, and I had a kind of screwy python installation. That is, I was using system python, and installed packages with sudo when that seemed to make things work. Now, I'm starting from a fresh OSX install, and trying to do it the Right Way. I've installed python and python3 from brew, and trying to use python3 whenever possible.
Problem: I have a .pythonrc file, which just imports a handful of commonly used packages - mostly standard lib, a few popular nonstandard packages, and a few of my own. In the past, this file has only been run when I start an interactive shell. Now, when using brew python, it is run whenever I run any python program.
There must be some gap in my understanding of the rc file - I thought the purpose was specifically for interactive use. Still, when I use system python, the rc file isn't used - so something is different about my system python (2.7.10 at /usr/bin/python) vs brew python (2.7.12 at /usr/local/bin/python; 3.5.2 at /usr/local/bin/python3). The behavior is the same if I remove everything except a print statement from the rc file.
edit: I realized that the rc file is running because I'm importing ipdb. This makes sense I suppose, but I still don't understand why that would happen in some of the python environments/versions but not others.
edit: https://github.com/gotcha/ipdb/blob/master/ipdb/main.py#L44 this line fails, not sure if this means anything.
Full stacktrace from within .pythonrc:
File "hello.py", line 1, in <module>
from ipdb import set_trace
File "/usr/local/lib/python2.7/site-packages/ipdb/__init__.py", line 7, in <module>
from ipdb.__main__ import set_trace, post_mortem, pm, run # noqa
File "/usr/local/lib/python2.7/site-packages/ipdb/__main__.py", line 51, in <module>
ipapp.initialize([])
File "<decorator-gen-109>", line 2, in initialize
File "/usr/local/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 315, in initialize
self.init_code()
File "/usr/local/lib/python2.7/site-packages/IPython/core/shellapp.py", line 263, in init_code
self._run_startup_files()
File "/usr/local/lib/python2.7/site-packages/IPython/core/shellapp.py", line 342, in _run_startup_files
self._exec_file(python_startup)
File "/usr/local/lib/python2.7/site-packages/IPython/core/shellapp.py", line 328, in _exec_file
raise_exceptions=True)
File "/usr/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2469, in safe_execfile
self.compile if kw['shell_futures'] else None)
File "/usr/local/lib/python2.7/site-packages/IPython/utils/py3compat.py", line 288, in execfile
builtin_mod.execfile(filename, *where)
File "~/.pythonrc", line 57, in <module>
import traceback; traceback.print_stack()
You can ask the traceback module:
$ cat .pythonrc
import traceback; traceback.print_stack()
$ cat test.py
import ipdb
Then by running
$ PYTHONSTARTUP="$HOME/.pythonrc" python test.py
you should get a traceback that tells you exactly from where the startup script is being run. Most likely, this is due to a call
start_ipython()
somewhere in the ipdb import.
I am trying to use rabbitmq in python.
My code is:
import pika
if __name__ == '__main__':
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
I am running this file using:
python3 test.py
Error Signature:
Traceback (most recent call last):
File "Test.py", line 4, in <module>
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 339, in __init__
self._process_io_for_connection_setup()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 374, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 395, in _flush_output
raise exceptions.ConnectionClosed()
pika.exceptions.ConnectionClosed
Already referred this , but i dont have any sleep in my code.
Not really sure what could go wrong.
Please let me know if I am missing something obvious.
The issue was with rabbitmqctl. Reconfigured it, Restarted service, and the issue is fixed.
Make sure rabbitmqctl is installed(if installed, uninstall it and re-install;when you just enter rabbitmqctl, it should display the help)
rabbitmqctl start_app
TIP: I tried installing first using 'brew',but for some reason, I was not able to get it right. So installed, rabbitmqctl as a separate package and added to PATH
I have installed robotframework-ride on two PCs of mine. Everything works fine on one PC but could not have RIDE running on other PC.
I have the following installed on both PCs
- Python 2.7.8 on win32
- Robot framework 2.8.6
- wxPython 2.8.12.1
- robotframeowkr-ride-1.4.1b
When I tried to execute "python ride.py" on the second PC, I got a message:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\robotide__init__.py", line 74, in main
run(inpath, not noupdatecheck, debug_console)
File "C:\Python27\lib\site-packages\robotide__init_.py", line 100, in run
ride = RIDE(inpath, updatecheck)
File "C:\Python27\lib\site-packages\robotide\application\application.py", line
41, in __init_
wx.App.init(self, redirect=False)
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_core.py", line 7981
, in init
self.BootstrapApp()
File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_core.py", line 7555
, in _BootstrapApp
return _core.PyApp__BootstrapApp(args, *kwargs)
File "C:\Python27\lib\site-packages\robotide\application\application.py", line
49, in OnInit
self.namespace = Namespace(self.settings)
File "C:\Python27\lib\site-packages\robotide\namespace\namespace.py", line 41,
in init
self._set_pythonpath()
File "C:\Python27\lib\site-packages\robotide\namespace\namespace.py", line 62,
in _set_pythonpath
self._settings.get('installed robot version', None))
File "C:\Python27\lib\site-packages\robotide\namespace\robotlibraryloader.py",
line 35, in find_installed_robot_libraries
rf_file, rf_version = output.strip().split(', ')
ValueError: too many values to unpack
Use --help to get usage information.
Something more interesting is, if I uninstall robot framework from the second PC, I could execute "python ride.py" but of course there is no point doing this.
Anyone can help me out here?
With kind assistance from janne, I have solved this problem. The cause is for the first PC I installed the correct "robotframework", but for the second PC I managed to install a wrong module, "robot" instead of "robotframework". That was why RIDE was not working.
I am sorry for making such a silly mistake. A big thank you to janne for his help.
should use: pip install robotframework
should NOT use: pip install robot
I've encountered a weird issue regrading the tracebacks in python. I've updated some code but while debugging, it's still using the outdated code. detailed traceback as below:
Error: Traceback (most recent call last):
File "~/myenv/lib/python2.7/site-packages/xxx/xmlrpc/dispatcher.py", line 95, in _marshaled_dispatch
response = self._dispatch(method, params)
File "/usr/lib64/python2.7/SimpleXMLRPCServer.py", line 420, in _dispatch
return func(*params)
File "~/myenv/lib/python2.7/site-packages/kobo/hub/decorators.py", line 24, in _new_func
return func(request, *args, **kwargs)
File "~/myenv/lib/python2.7/site-packages/myapp/worker.py", line 61, in register
download.save()
I'm pretty sure the exception thrown by download.save() is already removed. i.e., the line 61 in ~/myenv/lib/python2.7/site-packages/myapp/worker.py doesn't contain download.save():
$ grep -r "download.save" ~/myenv/lib/python2.7/site-packages/myapp/
no matchings found.
but it looks python still uses the out-dated code. my new changes still won't work.
besides, I've also removed the worker.pyc file under the save directory before running the scripts.
any ideas how to resolve the issue?
When you grep, and when you run the code, are they as the same user? Is the code running under a web server or similar daemon process, with a different username and a different home directory?
What if you remove all precompiled .pyc files?