Skype4Py Command timeout - python

I am using Skype4Py and create a skype bot.
I wanted to install the bot on a linux enviroment (Ubuntu 12.04 as I recall right)
And I installed skype and the bot + dependicies.
Now whenever I ask for message.Chat.Type, it gives me a command timeout..
Any solution?
error:
Exception in thread Skype4Py MessageStatus event scheduler:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/utils.py", line 225, in run
handler(*self.args, **self.kwargs)
File "functions/messageProcessor.py", line 161, in processMessages
if allowed(message, "url_parse"):
File "functions/messageProcessor.py", line 62, in allowed
chatType = message.Chat.Type
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/chat.py", line 405, in _GetType
return str(self._Property('TYPE'))
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/chat.py", line 33, in _Property
return self._Owner._Property('CHAT', self.Name, PropName, Value, Cache)
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/skype.py", line 296, in _Property
value = self._DoCommand('GET %s' % jarg, jarg)
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/skype.py", line 276, in _DoCommand
self.SendCommand(command)
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/skype.py", line 778, in SendCommand
self._Api.send_command(Command)
File "/usr/local/lib/python2.7/dist-packages/Skype4Py/api/posix_x11.py", line 445, in send_command
raise SkypeAPIError('Skype command timeout')
SkypeAPIError: Skype command timeout

Related

Why getting EOFError by using multiprocessing. Manager()?

In Python, to share data between different process by using multiprocessing, we use multiprocessing.Manager(). I want to get output [1,2,3,4,5,6,7,8,9,10] in the following code, but I am getting EOFError. Why?
The Code is:
import multiprocessing
manager=multiprocessing.Manager()
final_list=manager.list()
input_list_one=[1,2,3,4,5]
input_list_two=[6,7,8,9,10]
def worker(data):
for item in data:
final_list.append(item)
process_1=multiprocessing.Process(target=worker,args=[input_list_one])
process_2=multiprocessing.Process(target=worker,args=[input_list_two])
process_1.start()
process_2.start()
process_1.join()
process_2.join()
print(final_list)
I am getting the following error:
Process SyncManager-1:
Traceback (most recent call last):
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/managers.py", line 539, in _run_server
server = cls._Server(registry, address, authkey, serializer)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/managers.py", line 139, in __init__
self.listener = Listener(address=address, backlog=16)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 438, in __init__
self._listener = SocketListener(address, family, backlog)
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 576, in __init__
self._socket.bind(address)
PermissionError: [Errno 13] Permission denied
Traceback (most recent call last):
File "/storage/emulated/0/qpython/.last_tmp.py", line 2, in <module>
manager=multiprocessing.Manager()
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/context.py", line 56, in Manager
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/managers.py", line 517, in start
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 250, in recv
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 407, in _recv_bytes
File "/data/user/0/org.qpython.qpy3/files/lib/python36.zip/multiprocessing/connection.py", line 383, in _recv
EOFError
1|u0_a823#land:/ $

Python Redis - RuntimeError pubsub connection not set

Version: redis-py=3.1.0 and redis=3.2.10
Platform: Python 2.7.5 / CentOS Linux release 7.4.1708 (Core)
Infrastructure:
two machines (worker1, worker2 ) for running celery worker services with default concurrency (=8).
one dedicated machine (redis1) for running redis server.
Issue:
After the workers running for some time, suddenly a worker running on machine1 dies due to a RuntimeError raised losing a connection to pubsub.
machine1.worker.log
[2019-02-01 13:43:39,477: CRITICAL/MainProcess] Unrecoverable error: RuntimeError(u'pubsub connection not set: did you forget to call subscribe() or psubscribe()?',)
Traceback (most recent call last):
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/worker.py", line 205, in start
self.blueprint.start(self)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/bootsteps.py", line 369, in start
return self.obj.start()
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 322, in start
blueprint.start(self)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 598, in start
c.loop(*c.loop_args())
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/loops.py", line 91, in asynloop
next(loop)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/asynchronous/hub.py", line 354, in create_loop
cb(*cbargs)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/redis.py", line 1047, in on_readable
self.cycle.on_readable(fileno)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/redis.py", line 344, in on_readable
chan.handlers[type]()
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/redis.py", line 674, in _receive
ret.append(self._receive_one(c))
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/redis.py", line 685, in _receive_one
response = c.parse_response()
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/redis/client.py", line 3032, in parse_response
'pubsub connection not set: '
RuntimeError: pubsub connection not set: did you forget to call subscribe() or psubscribe()?
While at the same time I have spotted that worker running on machine2 suffers due to not being able to connect to redis. Eventually, it managed to recover and reconnect to redis and receiving the queued tasks.
machine2.worker.log
[2019-02-01 14:43:41,722: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 322, in start
blueprint.start(self)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 40, in start
self.sync(c)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 44, in sync
replies = self.send_hello(c)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/worker/consumer/mingle.py", line 57, in send_hello
replies = inspect.hello(c.hostname, our_revoked._data) or {}
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/app/control.py", line 143, in hello
return self._request('hello', from_node=from_node, revoked=revoked)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/app/control.py", line 95, in _request
timeout=self.timeout, reply=True,
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/celery/app/control.py", line 454, in broadcast
limit, callback, channel=channel,
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/pidbox.py", line 315, in _broadcast
serializer=serializer)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/pidbox.py", line 290, in _publish
serializer=serializer,
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/messaging.py", line 181, in publish
exchange_name, declare,
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/messaging.py", line 203, in _publish
mandatory=mandatory, immediate=immediate,
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/virtual/base.py", line 605, in basic_publish
message, exchange, routing_key, **kwargs
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/virtual/exchange.py", line 151, in deliver
exchange, message, routing_key, **kwargs)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/kombu/transport/redis.py", line 781, in _put_fanout
dumps(message),
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/redis/client.py", line 2716, in publish
return self.execute_command('PUBLISH', channel, message)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/redis/client.py", line 775, in execute_command
return self.parse_response(connection, command_name, **options)
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/redis/client.py", line 789, in parse_response
response = connection.read_response()
File "/opt/c1/cip-middleware/webapp/virtualenv/lib/python2.7/site-packages/redis/connection.py", line 636, in read_response
raise e
ConnectionError: Error while reading from socket: (u'Connection closed by server.',)
[2019-02-01 14:44:50,237: INFO/MainProcess] Received task: c1_cip_middleware.tasks.validate_purchases.run_purchases_validation[a411dd90-ab50-4101-becb-90adda3663a2]
* Questions *
I wonder what are the circumstances/scenarios when RuntimeError is raised, thus, the worker gets into the "unrecovery" stage and must be stopped?
I am in doubt what could be a root-cause of having this issue, especially that one worker managed to recover but the other one just died?

Too many files open error on app using Kafka

I'm building an app using Kafka and Spark Streaming. Input data comes from a third part streaming and it's published on a kafka topic. This code shows the Stream Proxy module: it's the way I get the results from the streaming and how I send them to KafkaPublisher (it's shown just a sketch):
def on_result_response(self,*args):
self.kafkaPublisher.pushMessage(str(args[0]))
The KafkaPublisher is realized with these two methods:
class KafkaPublisher:
def __init__(self,address,port,topic):
self.kafka = KafkaClient(str(address)+":"+str(port))
self.producer = SimpleProducer(self.kafka)
self.topic=topic
def pushMessage(self,message):
self.producer.send_messages(self.topic, message)
self.producer = SimpleProducer(self.kafka, async=True)
And the app is launched by this main:
from StreamProxy import StreamProxy
streamProxy=StreamProxy("localhost",9092,"task1")
streamProxy.getStreaming(20) #seconds of streaming
After some batch processing (10 seconds more or less) it's launched the following exceptions:
Exception in thread Thread-2354:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 754, in run
File "/usr/local/lib/python2.7/dist-packages/kafka/producer/base.py", line 164, in _send_upstream
File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 649, in send_produce_request
File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 253, in _send_broker_aware_request
File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 74, in _get_conn
File "/usr/local/lib/python2.7/dist-packages/kafka/conn.py", line 236, in connect
error: [Errno 24] Too many open files
Exception in thread Thread-2355:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 754, in run
File "/usr/local/lib/python2.7/dist-packages/kafka/producer/base.py", line 164, in _send_upstream
File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 649, in send_produce_request
File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 253, in _send_broker_aware_request
File "/usr/local/lib/python2.7/dist-packages/kafka/client.py", line 74, in _get_conn
File "/usr/local/lib/python2.7/dist-packages/kafka/conn.py", line 236, in connect
error: [Errno 24] Too many open files
Please note that there are many different exceptions with the same message and surely the problem is publisher-side.
Try to delete the row:
self.producer = SimpleProducer(self.kafka, async=True)

R CMD BATCH script.R ,execution via fabric run() never exits

I have written a fabric script with boto to install a R application on AWS instance. Fedora 23
All the commands using run & sudo function go as expected,
except this one:
#parallel
def install_DvD():
# with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True):
cmd0 = 'R CMD BATCH %s/DvDdependencies.R' % (DvDpackage_location)
run(cmd0)
As you would noticed, I tried using 'warn_only=true', and that did not help. The installation completes successfully with out errors, I check that manually by logging into the instance and eyeballing DvDdependencies.Rout file.
I think for reasons unkonwn to me the R CMD BATCH command does not return the execution back to fabric.
The traceback output from Ctrl^c the fabric process on my local system is:
[ec2-54-172-154-181.compute-1.amazonaws.com] run: R CMD BATCH ~/DvDdependencies.R
[ec2-54-165-109-62.compute-1.amazonaws.com] run: R CMD BATCH ~/DvDdependencies.R
^C
Stopped.
!!! Parallel execution exception under host u'ec2-54-165-109-62.compute-1.amazonaws.com':
!!! Parallel execution exception under host u'ec2-54-172-154-181.compute-1.amazonaws.com':
Process ec2-54-172-154-181.compute-1.amazonaws.com:
Traceback (most recent call last):
File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
Process ec2-54-165-109-62.compute-1.amazonaws.com:
self._target(*self._args, **self._kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/tasks.py", line 242, in inner
Traceback (most recent call last):
File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
submit(task.run(*args, **kwargs))
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
return self.wrapped(*args, **kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/decorators.py", line 181, in inner
self.run()
File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/tasks.py", line 242, in inner
return func(*args, **kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/fabfile.py", line 70, in install_DvD
run(cmd0)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/network.py", line 649, in host_prompting_wrapper
submit(task.run(*args, **kwargs))
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
return self.wrapped(*args, **kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/decorators.py", line 181, in inner
return func(*args, **kwargs)
return func(*args, **kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/operations.py", line 1056, in run
File "/home/eyebell/local_bin/healX/DvD-installation/fabfile.py", line 70, in install_DvD
run(cmd0)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/network.py", line 649, in host_prompting_wrapper
return func(*args, **kwargs)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/operations.py", line 1056, in run
shell_escape=shell_escape)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/operations.py", line 925, in _run_command
stderr=stderr, timeout=timeout)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/operations.py", line 811, in _execute
time.sleep(ssh.io_sleep)
KeyboardInterrupt
shell_escape=shell_escape)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/operations.py", line 925, in _run_command
stderr=stderr, timeout=timeout)
File "/home/eyebell/local_bin/healX/DvD-installation/py2fabvirt/lib/python2.7/site-packages/fabric/operations.py", line 811, in _execute
time.sleep(ssh.io_sleep)
KeyboardInterrupt
The complete script is here in my github repo,
the location of DvDdependencies.R (the script that I want to install)
Any comments, help or pointers in right direction are appreciated.
I am closing this, as the issue is with this script only.
Also the installation method for DvD tool has been updated,
hence this is not of interest anymore.

Running Trac 0.12 on Ubuntu 10.04 - Error

I've installed trac 0.12 on my ubuntu 10.04, running the tracd internal webserver. When i access the page at http://127.0.0.1/myTracProject, I get the error message:
Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/api.py", line 376, in send_error
'text/html') File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/chrome.py", line 733, in render_template
message = req.session.pop('chrome.%s.%d' % (type_, i)) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/api.py", line 195, in __getattr__
value = self.callbacks[name](self) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/main.py", line 265, in _get_session
return Session(self.env, req) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/session.py", line 157, in __init__
self.get_session(sid) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/session.py", line 178, in get_session
super(Session, self).get_session(sid, authenticated) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/web/session.py", line 59, in get_session
(sid, int(authenticated))) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/db/util.py", line 64, in execute
return self.cursor.execute(sql_escape_percent(sql), args) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.7-py2.6.egg/trac/db/util.py", line 64, in execute
return self.cursor.execute(sql_escape_percent(sql), args) InternalError: current transaction is aborted, commands ignored until end of transaction block
You installed Trac 0.12? Your traceback shows "Trac-0.11.7-py2.6.egg". Looks like you need to do some cleanup.

Categories