randy3k / radian

A 21 century R console
MIT License
2k stars 76 forks source link

Exception 'Application' object has no attribute 'session' #308

Closed rrodrigueznt closed 3 years ago

rrodrigueznt commented 3 years ago

Hi! After enjoying radian on my Samsung A50, I'm now trying to do the same in my brand new A52. After installation, radian starts correctly, but some keyboard entries (delete and enter among others) head to the exception:

Exception 'Application' object has no attribute 'session'

The whole message reads:

Unhandled exception in event loop:
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/eventloop/posix.py", line 155, in _run_task
    t()
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/eventloop/context.py", line 116, in new_func
    return func(*a, **kw)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/application/application.py", line 589, in read_from_input
    self.key_processor.process_keys()
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/key_binding/key_processor.py", line 275, in process_keys
    self._process_coroutine.send(key_press)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/key_binding/key_processor.py", line 165, in _process
    matches = self._get_matches(buffer)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/key_binding/key_processor.py", line 125, in _get_matches
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/key_binding/key_processor.py", line 125, in <listcomp>
    return [b for b in self._bindings.get_bindings_for_keys(keys) if b.filter()]
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/filters/base.py", line 133, in __call__
    return all(f() for f in self.filters)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/filters/base.py", line 133, in <genexpr>
    return all(f() for f in self.filters)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/lineedit/deps/prompt_toolkit/filters/base.py", line 216, in __call__
    return self.func()
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/radian/keybindings.py", line 65, in auto_match
    return get_app().session.auto_match

Exception 'Application' object has no attribute 'session'
Press ENTER to continue...

Please, any idea about the source of the error?

Thanks!

randy3k commented 3 years ago

What version of radian you have? Where did you install it from? radian doesn't have a file called "keybindings.py".

rrodrigueznt commented 3 years ago

What version of radian you have? Where did you install it from? radian doesn't have a file called "keybindings.py".

~ $ radian --version
radian version: 0.3.4
r executable: /data/data/com.termux/files/usr/lib/R/bin/R
r version: 4.1.0
python executable: /data/data/com.termux/files/usr/bin/python3
python version: 3.9.7
~ $

I would swear that I followed the instructions in the README.md but using pip3 instead of pip. But, radian 0.3.4?!

Thanks!

randy3k commented 3 years ago

Perhaps trying to update radian pip3 install -U radian

rrodrigueznt commented 3 years ago

Thanks. Here what I get:

~ $ pip3 install -U radian
Requirement already satisfied: radian in /data/data/com.termux/files/usr/lib/python3.9/site-packages (0.3.4)
Collecting radian
  Using cached radian-0.5.12.tar.gz (49 kB)
Collecting rchitect<0.4.0,>=0.3.30
  Using cached rchitect-0.3.32.tar.gz (30 kB)
    ERROR: Command errored out with exit status 1:
     command: /data/data/com.termux/files/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-_pgxbe39/rchitect_f7173a60f67a4ac584c118b2f00539a4/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-_pgxbe39/rchitect_f7173a60f67a4ac584c118b2f00539a4/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-zdxml16u
         cwd: /data/data/com.termux/files/usr/tmp/pip-install-_pgxbe39/rchitect_f7173a60f67a4ac584c118b2f00539a4/
    Complete output (45 lines):
    WARNING: The wheel package is not available.
    WARNING: The wheel package is not available.
      ERROR: Command errored out with exit status 1:
       command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-7vayjqsc/cffi_4302083c06f94846b6aaad8e13a08975/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-7vayjqsc/cffi_4302083c06f94846b6aaad8e13a08975/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /data/data/com.termux/files/usr/tmp/pip-wheel-ie8rgusq
           cwd: /data/data/com.termux/files/usr/tmp/pip-wheel-7vayjqsc/cffi_4302083c06f94846b6aaad8e13a08975/
      Complete output (6 lines):
      usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
         or: setup.py --help [cmd1 cmd2 ...]
         or: setup.py --help-commands
         or: setup.py cmd --help

      error: invalid command 'bdist_wheel'
      ----------------------------------------
      ERROR: Failed building wheel for cffi
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/data/data/com.termux/files/usr/lib/python3.9/subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmpm7bzgke0', '--quiet', 'cffi>=1.10.0']' returned non-zero exit status 1.

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/data/data/com.termux/files/usr/tmp/pip-install-_pgxbe39/rchitect_f7173a60f67a4ac584c118b2f00539a4/setup.py", line 32, in <module>
        setup(
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 152, in setup
        _install_setup_requires(attrs)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/dist.py", line 785, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 766, in resolve
        dist = best[req.key] = env.best_match(
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1051, in best_match
        return self.obtain(req, installer)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1063, in obtain
        return installer(requirement)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/dist.py", line 844, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/setuptools/installer.py", line 77, in fetch_build_egg
        raise DistutilsError(str(e)) from e
    distutils.errors.DistutilsError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmpm7bzgke0', '--quiet', 'cffi>=1.10.0']' returned non-zero exit status 1.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/87/59/c09c427a425816780dba42bba02d339004104303bfc88ef1b8e0ce7644fb/rchitect-0.3.32.tar.gz#sha256=82103b1a8d44dd3706aa0bd8e8254fe5428dd52d462f0cb9866c583eb7286ac3 (from https://pypi.org/simple/rchitect/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Here what I have at /site-packages

.../python3.9/site-packages $ ls
Pygments-2.10.0.dist-info
README.txt
__pycache__
_distutils_hack
distutils-precedence.pth
lineedit
lineedit-0.1.6-py3.9.egg-info
pip
pip-21.2.4.dist-info
pkg_resources
pygments
radian
radian-0.3.4-py3.9.egg-info
rchitect
rchitect-0.2.4-py3.9.egg-info
setuptools
setuptools-57.4.0.dist-info
six-1.16.0.dist-info
six.py
wcwidth
wcwidth-0.2.5.dist-info
xcbgen
.../python3.9/site-packages $

Then, I run pip3 install wheel and pip3 install -U radian again. Here what I get now:

~ $ radian --version
radian version: 0.5.12
r executable: /data/data/com.termux/files/usr/lib/R/bin/R
r version: 4.1.0
python executable: /data/data/com.termux/files/usr/bin/python3
python version: 3.9.7

And radian is working now! Please, could a note on this issue in README.md be helpful? Was it a particular issue of my installation?

Thanks for your help!