Page 2 of 2

Re: Install aioble with upip?

Posted: Thu Oct 21, 2021 8:12 am
by esp32bob
If I copy

Code: Select all

__init__.py
to

Code: Select all

aioble.py
then I get this error:

Code: Select all

>>> import aioble.py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "aioble.py", line 6, in <module>
ImportError: can't perform relative import

Re: Install aioble with upip?

Posted: Thu Oct 21, 2021 8:28 am
by esp32bob
davef wrote:
Thu Oct 21, 2021 7:04 am
When the files are copied to /pyboard/
then you should be able to do:

Code: Select all

cd /pyboard
repl
Ctrl-D
import aioble
Then we can deal with the errors that arise from that.
Finally got it all working. Thanks for your interest and help. I *was sure* I have tried this before, but here is what worked this time.
All in rshell.

Code: Select all

/pyboard> mkdir aioble
cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* ./aioble
/pyboard> repl
Entering REPL. Use Control-X to exit.
>
MicroPython v1.17 on 2021-09-02; ESP32 module with ESP32
Type "help()" for more information.
>>>
>>> import aioble
>>>
Can't explain why that didn't work before.

Re: Install aioble with upip?

Posted: Thu Oct 21, 2021 8:34 am
by davef
Great. For my edification can you explain:

Code: Select all

cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* ./aioble
/pyboard> repl
I would have expected the command to be:

Code: Select all

cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* /pyboard/aioble/> repl
The specific part .... ./aioble/pyboard

Re: Install aioble with upip?

Posted: Thu Oct 21, 2021 6:03 pm
by dhylands
I think that the first command assumed that the current directory was /pyboard.

Using /pyboard/aioble eliminates the current directory from the equation (i.e. it will work regardless of the current directory is).

And to be clear, I'm saying that this:

Code: Select all

cd /pyboard
cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* ./aioble
is equivalent to

Code: Select all

cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* /pyboard/aioble
The first example that shows /pyboard> repl on the second line is showing the prompt (/pyboard>) followed by a command (repl).

The second example has an extraneous /> repl at the end of the line which shouldn't be there.

Re: Install aioble with upip?

Posted: Thu Oct 21, 2021 6:35 pm
by davef
Dave,

Thank you for the clear explanation. When I saw ./aioble I thought it was running aioble like one does with a Bash or Python script from the command line.

Re: Install aioble with upip?

Posted: Thu Oct 21, 2021 10:12 pm
by dhylands
./aioble is just a relative path. If it’s the first thing on the command line then you would be executing a program. If it’s not the first thing then is just an argument being passed to a program and could refer to a file or a directory.

Re: Install aioble with upip?

Posted: Fri Oct 22, 2021 4:17 am
by davef
Thanks.

Re: Install aioble with upip?

Posted: Sun Oct 24, 2021 5:58 am
by esp32bob
dhylands wrote:
Thu Oct 21, 2021 6:03 pm
I think that the first command assumed that the current directory was /pyboard.

Using /pyboard/aioble eliminates the current directory from the equation (i.e. it will work regardless of the current directory is).

And to be clear, I'm saying that this:

Code: Select all

cd /pyboard
cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* ./aioble
is equivalent to

Code: Select all

cp /opt/micropython-lib/micropython/bluetooth/aioble/aioble/* /pyboard/aioble
The first example that shows /pyboard> repl on the second line is showing the prompt (/pyboard>) followed by a command (repl).

The second example has an extraneous /> repl at the end of the line which shouldn't be there.
Sorry for the delay in replying. This is exactly what I was doing. I was already in

Code: Select all

/pyboard
and so used

Code: Select all

./aioble
rather than the more explict

Code: Select all

/pyboard/aioble
Thank you both for the help and information

Re: Install aioble with upip?

Posted: Tue Jun 27, 2023 10:34 pm
by PieyeGmbH
That might help:
https://github.com/micropython/micropyt ... ree/master

for me, the following did the trick:
import mip
mip.install("aioble")

import aioble