codelv / enaml-native-cli

CLI and package manager for building enaml-native apps
https://www.codelv.com/projects/enaml-native/
GNU General Public License v3.0
13 stars 7 forks source link

Error Remote debugging with Python 3.6 #16

Closed samtux closed 6 years ago

samtux commented 6 years ago

I'm trying to follow the tutorial to debug the application on Android, however I've had many problems and it doesn't work correctly.

Docs Remote debugging

The working environment is:

Arch Linux x64 miniconda v4.5.4 Python v3.6.6 (venv)

The packages list is:

% conda list '#packages in environment at /home/samtux/tmp/apps/enamlapp1/Prueba1/venv: '# '#Name....................Version...................Build Channel android-atom..............0.4.2.a0.................py36_0....codelv android-enaml.............0.10.3.a0................py36_0....codelv android-libcxx............11............................0....codelv android-msgpack...........0.5.6....................py36_0....codelv android-python............3.6.5............py36hcd2fc09_1....codelv arrow.....................0.12.1.................... atom......................0.4.1..................... binaryornot...............0.4.4..................... bzip2.....................1.0.6................h470a237_2....conda-forge ca-certificates...........2018.4.16.....................0....conda-forge certifi...................2018.4.16................py36_0....conda-forge chardet...................3.0.4..................... click.....................6.7....................... cookiecutter..............1.6.0..................... enaml.....................0.10.2.................... enaml-native..............4.5.4..................... enaml-native..............4.5.2................hfa6c452_0....codelv future....................0.16.0.................... idna......................2.7....................... Jinja2....................2.10...................... jinja2-time...............0.2.0..................... kiwisolver................1.0.1..................... libffi....................3.2.1.........................3....conda-forge libgcc-ng.................7.2.0................hdf63c60_3.. libstdcxx-ng..............7.2.0................hdf63c60_3.. MarkupSafe................1.0....................... msgpack...................0.5.6..................... ncurses...................6.1..................hfc679d8_1....conda-forge openssl...................1.0.2o...............h470a237_1....conda-forge pbs.......................0.110..................... pip.......................18.0.....................py36_1....conda-forge pip-ply...................3.11.................h62cefb9_1....codelv ply.......................3.11...................... poyo......................0.4.1..................... python....................3.6.6................h5001a0f_0....conda-forge python-dateutil...........2.7.3..................... QtPy......................1.4.2..................... readline..................7.0..................haf1bffa_1....conda-forge requests..................2.19.1.................... ruamel.yaml...............0.15.52................... setuptools................40.0.0...................py36_1....conda-forge sh........................1.12.14................... six.......................1.11.0.................... sqlite....................3.24.0...............h2f33b56_0....conda-forge tk........................8.6.8.........................0....conda-forge tornado...................5.1....................... urllib3...................1.23...................... wheel.....................0.31.1...................py36_1....conda-forge whichcraft................0.4.1..................... xz........................5.2.4................h470a237_1....conda-forge zlib......................1.2.11...............h470a237_3....conda-forge

First, when installing the dependencies it registers an error by version number:

% pip install enaml-native >= 2.12.0

  Could not find a version that satisfies the requirement 2.12.0 (from versions: )
No matching distribution found for 2.12.0

The solution was to perform the installation as follows. Including the ENAML package::

% pip install  enaml-native
% pip install  enaml

Then, it logs an error for another additional dependency

Then it logs errors for missing packages 'msgpack' and 'tornado'.

% pip install msgpack
% pip install tornado

the last error, is due to an error when importing a function from the enaml package, which does not exist

% python src/main.py                   

 from .picker import Picker
  File "/home/samtux/tmp/apps/enamlapp1/Prueba1/venv/lib/python3.6/site-packages/enamlnative/widgets/picker.py", line 17, in <module>
    from enaml.compat import str
ImportError: cannot import name 'str'

    from .snackbar import Snackbar
  File "/home/samtux/tmp/apps/enamlapp1/Prueba1/venv/lib/python3.6/site-packages/enamlnative/widgets/snackbar.py", line 17, in <module>
    from enaml.compat import str
ImportError: cannot import name 'str'

The solution was to comment on the function to be imported, and finally change 'str' to 'Unicode()''.

Finally, the application start in Android, but is only locked in the background splash. I have tried to follow the documentation but I have not been able to perform the remote debugging.

I share the project in: MEGA

frmdstryr commented 6 years ago

Sorry, I need to update the docs. The versions there are about a year old from when I first added remote debugging and before python 3 support was added.

Please uninstall those old versions and use the latest versions from conda (which should be used when you create a new app).

The rest should work, let me know if you run into issues. I'll get on https://gitter.im/enaml-native/Lobby.

samtux commented 6 years ago

Thanks @frmdstryr, I managed to do the remote debugging, configuring the debugging on my mobile device and install dependencies from conda.

It is necessary to write a note in the documentation when starting the script:

  1. First init enaml-native start --remote-debugging
  2. Install the application on the mobile device and start App
  3. Start python src/main.py

One last question, how does the enaml-native installcommand work?

frmdstryr commented 6 years ago

Great! Feel free to do a PR to update the docs.

It is just an alias to conda install <args> and then it runs enaml-native link.

See https://github.com/codelv/enaml-native-cli/blob/master/enamlnativecli/main.py#L727

samtux commented 6 years ago

Thank you @frmdstryr . Great software you develop, and the most enjoyable with Python.