mouuff / mtranslate

A simple api for google translate
MIT License
286 stars 83 forks source link

TypeError: 'NoneType' object is not callable #21

Closed ArtanisTheOne closed 3 years ago

ArtanisTheOne commented 3 years ago
Traceback (most recent call last):
  File "C:\Users\localadmin\AppData\Roaming\Python\Python39\site-packages\guilded\__main__.py", line 201, in websocket_process
    await c(*ctx.arguments)
  File "c:\RitaBot\PythonGuilded\bot.py", line 45, in translate
    translate1 = translate(argstr, Lang, "auto")
TypeError: 'NoneType' object is not callable

I'm using it like follows:

import mtranslate
from mtranslate import translate

def converttostr(input_seq, seperator):
  # Join all strings in list
  final_str = seperator.join(input_seq)
  return final_str

def translate(ctx, *args):
    message = ctx.message.content
    message = message[11:]
    msgList = message.split()
    Lang = msgList[0]

    del msgList[0]

    seperator=" "
    argstr = converttostr(input_seq=msgList, seperator=seperator)
    print(Lang)
    print(argstr)

    translate1 = translate(argstr, Lang, "auto")
    print(translate1)

I've tried just adding in static strings instead of splitting up arguments from another library and same error.

Anyone have any solution?

ArtanisTheOne commented 3 years ago

Oh on second look it looks like my issue is with another library