dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.59k stars 1.44k forks source link

Cannot import dronekit on Python 3 #891

Open otsuka-kohei opened 5 years ago

otsuka-kohei commented 5 years ago

Hello.

I am trying make programs with dronekit and python 3 on windows 10 1809. But when I import dronekit library, python shows error like bellow.

>>> from dronekit import connect
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\otsuka\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dronekit\__init__.py", line 2192
    await = set(types)
          ^
SyntaxError: invalid syntax

Must I use python 2.7?

Thank you.

peterbarker commented 5 years ago

On Mon, 17 Dec 2018, Otsuka Kohei wrote:

I am trying make programs with dronekit and python 3 on windows 10 1809. But when I import dronekit library, python shows error like bellow.

Are you using dronekit-python from the github repository or pipi?

If that latter - try the former.

otsuka-kohei commented 5 years ago

Thank you for your response.

pip list result like bellow.

Package           Version
----------------- --------
astroid           2.1.0
colorama          0.4.1
dronekit          2.9.1

dronekit which I installed looks like latest release.

I installed dronekit by pip install dronekit. If I install dronekit from github repo on windows, I have to execute instruction according to this page?

otsuka-kohei commented 5 years ago

Current __init__.py dows not have line await = set(types). So mey be I can escape this problem my replacing from \Python37-32\lib\site-packages\dronekit to dronekit-python/dronekit/ (this repo source).

otsuka-kohei commented 5 years ago

I replaced from pip installed dronekit to latest github repo dronekit source, and SyntaxError does not appear. Thank you.

But I stuck on #759, so I cannot use dronekit on Python 3.7.1 successfully.

pietrodn commented 5 years ago

The "await" bug was fixed in #840. So you need to use master. Try to enable detailed logging:

import logging
logging.basicConfig(level=logging.DEBUG)

at the beginning of your application, and please post a code sample and the full logs.

pietrodn commented 5 years ago

I just tried and DroneKit's tests run successfully on Python 3.7: CircleCI logs

drnic commented 5 years ago

For others, I added the following to my requirements.txt:

-e git://github.com/dronekit/dronekit-python#egg=dronekit
justinclift commented 4 years ago

This seems like it could be closed, with the 2.9.2 release having been done a while back.

As a related data point though, the DroneKit installation page specifically says Python 3.6 is not supported:

    https://dronekit-python.readthedocs.io/en/latest/develop/installation.html

Is that just a case of the docs needing to have the latest version deployed? That doc site is still saying 2.9.1 is the latest release.

pietrodn commented 4 years ago

The docs need to be updated. The tests are passing on Python 3.6, and I was literally flying drones with DroneKit on Python 3 :-)

pietrodn commented 4 years ago

I made this PR: https://github.com/dronekit/dronekit-python/pull/1040

justinclift commented 4 years ago

... I was literally flying drones with DroneKit on Python 3

Thanks @pietrodn. :smile:

Yeah, I was looking around for an ArduPilot SDK, but skipped DroneKit because the official docs literally say it's Python 2 only and Python 3 isn't supported.

Fortunately, a fellow project dev also mentioned they've used DroneKit with Python 3, thus took a second look. :smile:

Turbullance commented 3 years ago

Hi how do i install dronekit using the github respository?

AnaghBenjwal commented 1 year ago

Hi how do i install dronekit using the github respository?

were you able to solve this?

AlexanderZ3 commented 1 year ago

hi

not yet you can try Tello EDU to validate the drone-related algorithm. which has mature SDK and is not expensive.

best zezhong

At 2022-11-07 12:28:44, "Anagh Benjwal" @.***> wrote:

Hi how do i install dronekit using the github respository?

were you able to solve this?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>