tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.05k stars 2.23k forks source link

KeyError: 'eplus' / part of config file name: config.eplus #2664

Closed jowiemann closed 5 years ago

jowiemann commented 5 years ago

My next issue:

Traceback (most recent call last): File "yowsup-cli", line 518, in if not parser.process(): File "yowsup-cli", line 416, in process super(DemosArgParser, self).process() File "yowsup-cli", line 193, in process self._config = self._config_manager.load_path(self.args["config"]) File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 78, in load_path configtype = self.guess_type(path) File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 103, in guess_type return self.MAP_EXT[ext] KeyError: 'eplus'

eplus is part of the config file Name: config.eplus

tgalal commented 5 years ago

it's a bug, i think if you remove the file extension "eplus" or change it to .json (if your config is in json format) it would fix it.

jowiemann commented 5 years ago

Ok, removed the extention, and getting the next error (this config file was working for at least 2 years):

Traceback (most recent call last): File "yowsup-cli", line 518, in if not parser.process(): File "yowsup-cli", line 416, in process super(DemosArgParser, self).process() File "yowsup-cli", line 193, in process self._config = self._config_manager.load_path(self.args["config"]) File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 85, in load_path return self.load_data(datadict) File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 91, in load_data return ConfigSerialize(Config).deserialize(datadict) File "/opt/fhem/yowsup-master/yowsup/config/base/serialize.py", line 26, in deserialize data = transform.reverse(data) File "/opt/fhem/yowsup-master/yowsup/config/transforms/props.py", line 34, in reverse key, val = target(key, val) if type(target) == types.FunctionType else (key, target) File "/opt/fhem/yowsup-master/yowsup/config/v1/serialize.py", line 34, in "id": lambda key, val: (key, base64.b64decode(val)), File "/usr/lib/python2.7/base64.py", line 78, in b64decode raise TypeError(msg) TypeError: Incorrect padding

Same error when using the following config file for new registration: cc=49 phone=49xxxxxxxxxx id=0000000000 password=

Traceback (most recent call last): File "yowsup-cli", line 518, in if not parser.process(): File "yowsup-cli", line 315, in process super(RegistrationArgParser, self).process() File "yowsup-cli", line 193, in process self._config = self._config_manager.load_path(self.args["config"]) File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 85, in load_path return self.load_data(datadict) File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 91, in load_data return ConfigSerialize(Config).deserialize(datadict) File "/opt/fhem/yowsup-master/yowsup/config/base/serialize.py", line 26, in deserialize data = transform.reverse(data) File "/opt/fhem/yowsup-master/yowsup/config/transforms/props.py", line 34, in reverse key, val = target(key, val) if type(target) == types.FunctionType else (key, target) File "/opt/fhem/yowsup-master/yowsup/config/v1/serialize.py", line 34, in "id": lambda key, val: (key, base64.b64decode(val)), File "/usr/lib/python2.7/base64.py", line 78, in b64decode raise TypeError(msg) TypeError: Incorrect padding

Thanks for your work and support

tgalal commented 5 years ago

'id' is supposed to be b64 encoded string. I suggest you delete 'id' and 'password' (password is not used any more) from your config file and try again

jowiemann commented 5 years ago

Thank you. Registration works. Now I got some Infos in json notation. What are the next step. Please excuse, but where can I find such infos.

Greetings Jörg

tgalal commented 5 years ago

Next step is to just login. yowsup already automatically stored this information and will use it when the same phone number is supplied.

If interested, on linux you can find this auto persisted config at ~/.config/yowsup/{phone_number}/config.json

I still need to add some documentation to describe this.

jowiemann commented 5 years ago

A good feature. But now I am falling into the issue:

Traceback (most recent call last): File "/opt/fhem/yowsup-master/yowsup/layers/network/dispatcher/dispatcher_socket.py", line 38, in connectAndLoop self.connectionCallbacks.onConnected() File "/opt/fhem/yowsup-master/yowsup/layers/network/layer.py", line 39, in onConnected self.emitEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECTED)) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 88, in emitEvent if self.upper and not self.upper.onEvent(yowLayerEvent): File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 212, in onEvent stopEvent = stopEvent or s.onEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 109, in onEvent return self.event_callbackseventName File "/opt/fhem/yowsup-master/yowsup/layers/auth/layer_authentication.py", line 37, in on_connected passive=self.getProp(self.PROP_PASSIVE, False) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 202, in subBroadcastEvent self.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 103, in broadcastEvent self.lower.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 103, in broadcastEvent self.lower.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 103, in broadcastEvent self.lower.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 103, in broadcastEvent self.lower.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 98, in broadcastEvent if self.lower and not self.lower.onEvent(yowLayerEvent): File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 109, in onEvent return self.event_callbackseventName File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 55, in on_auth config = self._config_manager.load(self._username) # type: yowsup.config.v1.config.Config File "/opt/fhem/yowsup-master/yowsup/config/manager.py", line 41, in load config_dir = StorageTools.getStorageForPhone(username) File "/opt/fhem/yowsup-master/yowsup/common/tools.py", line 99, in getStorageForPhone return StorageTools.constructPath(phone + '/') TypeError: unsupported operand type(s) for +: 'long' and 'str' E 2019-04-23 22:45:20,380 yowsup.layers.network.dispatcher.dispatcher_socket - unsupported operand type(s) for +: 'long' and 'str'

Starting the Demos with: python yowsup-cli demos --config-phone 49xxxxxxxxx --config-cc 49 -y will open the client. The command /L is bringing up the error.

jowiemann commented 5 years ago

Ok, tryied the following: Putting the two lines after line 98:

        if type(phone) is long:
            phone = str(phone)

Then the next Problem raises:

I 2019-04-23 22:54:57,659 yowsup.layers.network.layer - Connecting to e16.whatsapp.net:443 I 2019-04-23 22:55:05,465 yowsup.axolotl.manager - Loaded 812 unsent prekeys Traceback (most recent call last): File "/opt/fhem/yowsup-master/yowsup/layers/network/dispatcher/dispatcher_socket.py", line 42, in connectAndLoop self.connectionCallbacks.onRecvData(data) File "/opt/fhem/yowsup-master/yowsup/layers/network/layer.py", line 82, in onRecvData self.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/network/layer.py", line 85, in receive self.toUpper(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer_noise_segments.py", line 39, in receive self.toUpper(bytes(data)) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 149, in receive self._flush_incoming_buffer() File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 137, in _flush_incoming_buffer self.toUpper(self._wa_noiseprotocol.receive()) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/coder/layer.py", line 21, in receive self.toUpper(node) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/logger/layer.py", line 14, in receive self.toUpper(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_control.py", line 32, in receive self.toUpper(protocolTreeNode) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/init__.py", line 194, in receive s.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_receive.py", line 39, in receive self.toUpper(protocolTreeNode) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 194, in receive s.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 130, in receive recv(node) File "/opt/fhem/yowsup-master/yowsup/layers/auth/layer_authentication.py", line 63, in handleSuccess self.broadcastEvent(successEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 202, in subBroadcastEvent self.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 103, in broadcastEvent self.lower.broadcastEvent(yowLayerEvent) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 98, in broadcastEvent if self.lower and not self.lower.onEvent(yowLayerEvent): File "/opt/fhem/yowsup-master/yowsup/layers/init__.py", line 109, in onEvent return self.event_callbackseventName File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_control.py", line 59, in onAuthed self._unsent_prekeys.clear() AttributeError: 'list' object has no attribute 'clear' E 2019-04-23 22:55:19,098 yowsup.layers.network.dispatcher.dispatcher_socket - 'list' object has no attribute 'clear' general: Disconnected:

tgalal commented 5 years ago

I've updated master with fixes to issues mentioned here, can you please try and confirm if it worked? Thanks for posting the error outputs!

jowiemann commented 5 years ago

The three fix are working. But evrey time there is a "but" When sending a message from the command line the first time, the following error is reportet:

python yowsup-cli demos --config-phone 49163xxxxxx --config-cc 49 -s 49162xxxxxxx "Dies ist ein Test"

I 2019-04-23 23:32:17,232 yowsup.layers.network.layer - Connecting to e2.whatsapp.net:443 I 2019-04-23 23:32:17,443 yowsup.axolotl.manager - Generating 812 prekeys I 2019-04-23 23:32:31,575 yowsup.axolotl.manager - Storing 812 prekeys I 2019-04-23 23:33:14,585 yowsup.axolotl.manager - Loaded 812 unsent prekeys W 2019-04-23 23:33:25,656 yowsup.layers.protocol_ib.layer - ignoring edge_routing ib node for now W 2019-04-23 23:33:25,755 yowsup.layers.protocol_ib.layer - ignoring attestation ib node for now Traceback (most recent call last): File "/opt/fhem/yowsup-master/yowsup/layers/network/dispatcher/dispatcher_socket.py", line 40, in connectAndLoop data = socket.recv(1024) File "/usr/lib/python2.7/socket.py", line 174, in _dummy raise error(EBADF, 'Bad file descriptor') error: [Errno 9] Bad file descriptor E 2019-04-23 23:33:27,669 yowsup.layers.network.dispatcher.dispatcher_socket - [Errno 9] Bad file descriptor I 2019-04-23 23:33:27,721 yowsup.layers.network.layer - Connecting to e2.whatsapp.net:443 I 2019-04-23 23:33:31,194 yowsup.axolotl.manager - Loaded 0 unsent prekeys W 2019-04-23 23:33:32,679 yowsup.layers.protocol_ib.layer - ignoring edge_routing ib node for now WARNING:root:Ignoring psa notification for now INFO:transitions.core:Exited state transport INFO:transitions.core:Entered state transport INFO:transitions.core:Exited state transport INFO:transitions.core:Entered state transport INFO:transitions.core:Exited state transport INFO:transitions.core:Entered state transport

Tryiong it again will give the following error: I 2019-04-23 23:35:51,244 yowsup.layers.network.layer - Connecting to e11.whatsa pp.net:443 I 2019-04-23 23:35:55,252 yowsup.axolotl.manager - Loaded 0 unsent prekeys W 2019-04-23 23:35:56,932 yowsup.layers.protocol_ib.layer - ignoring edge_routin g ib node for now I 2019-04-23 23:35:57,213 yowsup.demos.sendclient.layer - Message sent Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.target(*self.args, **self.__kwargs) File "/opt/fhem/yowsup-master/yowsup/layers/network/dispatcher/dispatcher_sock et.py", line 42, in connectAndLoop self.connectionCallbacks.onRecvData(data) File "/opt/fhem/yowsup-master/yowsup/layers/network/layer.py", line 82, in onR ecvData self.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/network/layer.py", line 85, in rec eive self.toUpper(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer_noise_segments.py", li ne 39, in receive self.toUpper(bytes(data)) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 149, in rece ive self._flush_incoming_buffer() File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 137, in _flu sh_incoming_buffer self.toUpper(self._wa_noiseprotocol.receive()) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/coder/layer.py", line 21, in recei ve self.toUpper(node) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/logger/layer.py", line 14, in rece ive self.toUpper(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_control.py", line 32 , in receive self.toUpper(protocolTreeNode) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 194, in receive s.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_receive.py", line 39 , in receive self.toUpper(protocolTreeNode) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 194, in receive s.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/init__.py", line 130, in receive recv(node) File "/opt/fhem/yowsup-master/yowsup/layers/protocol_acks/layer.py", line 17, in recvAckNode self.toUpper(IncomingAckProtocolEntity.fromProtocolTreeNode(node)) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 79, in toUpper self.upper.receive(data) File "/opt/fhem/yowsup-master/yowsup/layers/interface/interface.py", line 80, in receive self.entity_callbacksentityType File "/opt/fhem/yowsup-master/yowsup/demos/sendclient/layer.py", line 45, in o nAck raise KeyboardInterrupt() KeyboardInterrupt

Exception in thread YowPingThread-3: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in bootstrap_inner self.run() File "/opt/fhem/yowsup-master/yowsup/layers/protocol_iq/layer.py", line 105, i n run self._layer.sendIq(ping) File "/opt/fhem/yowsup-master/yowsup/layers/protocol_iq/layer.py", line 34, in sendIq self._sendIq(entity, self.onPong) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 151, in _sendIq self.toLower(iqEntity.toProtocolTreeNode()) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 198, in send s.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_send.py", line 52, i n send self.toLower(node) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/axolotl/layer_control.py", line 22 , in send self.toLower(node) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/logger/layer.py", line 9, in send self.toLower(data) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/coder/layer.py", line 16, in send self.write(self.writer.protocolTreeNodeToBytes(data)) File "/opt/fhem/yowsup-master/yowsup/layers/coder/layer.py", line 25, in write self.toLower(bytearray(i)) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.__lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 132, in send self._wa_noiseprotocol.send(data) File "/usr/local/lib/python2.7/dist-packages/consonance-0.1.0-py2.7.egg/conson ance/protocol.py", line 108, in send self._transport.send(data) File "/usr/local/lib/python2.7/dist-packages/consonance-0.1.0-py2.7.egg/conson ance/transport.py", line 27, in send self._stream.write_segment(ciphertext) File "/usr/local/lib/python2.7/dist-packages/consonance-0.1.0-py2.7.egg/conson ance/streams/segmented/blockingqueue.py", line 51, in write_segment self._events_callback(self.EVENT_WRITE) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer.py", line 120, in _han dle_stream_event self.toLower(self._stream.get_write_segment()) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/noise/layer_noise_segments.py", li ne 26, in send self.toLower(struct.pack('>I', len(data))[1:]) File "/opt/fhem/yowsup-master/yowsup/layers/init.py", line 84, in toLower self.__lower.send(data) File "/opt/fhem/yowsup-master/yowsup/layers/network/layer.py", line 79, in sen d self.serverConnection.sendData(data) File "/opt/fhem/yowsup-master/yowsup/layers/network/dispatcher/dispatcher_sock et.py", line 58, in sendData self.socket.send(data) AttributeError: 'NoneType' object has no attribute 'send'

In both cases the message is send. Starting the command line client Messages are send without error.

tgalal commented 5 years ago

Thanks for the update. I think the "send message and exit" demo is partially broken; it does successfully send the message but fails to properly shutdown. The "echo" demo also should work fine but will not cleanly exit when requested. I'll work later on updating those demos. The command line client should work fine as you described though.

felipefreitas commented 5 years ago

Hi! It seems I have this same issue. I've just registered and when I execute:

yowsup-cli demos -y --config ~/.config/yowsup/{NUMBER_HIDDEN}/config.json

and

/L (for login)

Appears this exception and message doesn't sent:

I 2019-04-24 02:07:48,545 yowsup.layers.network.layer - Connecting to e1.whatsapp.net:443
I 2019-04-24 02:07:48,566 yowsup.axolotl.manager - Loaded 0 unsent prekeys
general: Login Failed, reason: 401
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/yowsup-3.0.0-py3.6.egg/yowsup/layers/network/dispatcher/dispatcher_socket.py", line 40, in connectAndLoop
    data = socket.recv(1024)
OSError: [Errno 9] Bad file descriptor
E 2019-04-24 02:07:50,652 yowsup.layers.network.dispatcher.dispatcher_socket - [Errno 9] Bad file descriptor
general: Disconnected: 

Could you help me?

tgalal commented 5 years ago

@felipefreitas that's not the same issue, Login Failed, reason: 401 it's possible you are blocked, try register again

tgalal commented 5 years ago

fixed in v3.1.0

HeinzFo commented 5 years ago

Again this issue since 29. April 2019 round 8 PM

[https://github.com/tgalal/yowsup/issues/2702]

tgalal commented 5 years ago

@HeinzFo read my last comment and look at your yowsup version

HeinzFo commented 5 years ago

@tgalal Yes shure I have installed v3.1.0 yesterday but the issues is pressent. By new register of a the same phone number the number is blocked. By register a new phone number same behavior. I use landline numbers and this works some years in the past.

Regrads Heinz

tgalal commented 5 years ago

obviously what you are describing has absolutely nothing to do with this issue title "KeyError: 'eplus' / part of config file name: config.eplus "