SkynetLabs / python-skynet

Library for integrating Skynet with Python applications
MIT License
15 stars 8 forks source link

getting this error when i try to run and i use clien as intentionally #7

Open mmani648 opened 2 years ago

mmani648 commented 2 years ago
Exception in thread Thread-133:
Traceback (most recent call last):
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "gh.py", line 40, in send
    skylink =clien.upload_file('cctv.jpg')
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\site-packages\siaskynet\_upload.py", line 87, in upload_file
    sia_url = utils.uri_skynet_prefix() + response.json()["skylink"]
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Nc\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
mrcnski commented 2 years ago

Can you please provide a snippet of your code, too?

mmani648 commented 2 years ago
def send():
    time.sleep(5)
    cv2.imwrite(filename='cctv.jpg', img=frame)
    skylink = clien.upload_file('cctv.jpg')
    limb = "https://siasky.net"+skylink.strip("sia:")
    message = client.messages.create(
                          body=f"person detected confidence is {conf}",
                          media_url=limb,
                          from_='whatsapp:+#####',
                          to='whatsapp:+#####'
                      )
t1 = threading.Thread(target=send)
if label ==['person']:
    t1.start()
mrcnski commented 2 years ago

We've been having some issues with our servers that could be causing this. Can you please try again or try uploading to e.g. https://siasky.xyz?

Also: the error message should be improved on our end -- but we're not really actively working on this SDK right now. I'll leave the issue open though.