Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator #27

Closed
erbett opened this issue Oct 21, 2014 · 18 comments
Closed

Comments

@erbett
Copy link

erbett commented Oct 21, 2014

Hello, Antti.

I'm facing the same issue related in #23. However, I can't find a solution. The error message displayed in fmbt-scripter is:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 591, in init
self.open()
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 667, in open
raise TizenConnectionError('Connecting to a Tizen device/emulator with "sdb -s %s shell" failed.' % (self._serialNumber,))
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator with "sdb -s emulator-26101 shell" failed.

My results:
$which sdb:
/home/tizen/tizen-sdk/tools/sdb

$ sdb version
Smart Development Bridge version 2.2.48

$python -c 'import fmbttizen; print fmbttizen.Device(pythonCommand="/opt/python/bin/python")'
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 591, in init
self.open()
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 667, in open
raise TizenConnectionError('Connecting to a Tizen device/emulator with "sdb -s %s shell" failed.' % (self._serialNumber,))
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator with "sdb -s emulator-26101 shell" failed.

$sdb -s emulator-26101 shell
->shell opens successfully

$python -c 'print "hello"'
hello

$/opt/python/bin/python -c 'print "hello"'
bash: /opt/python/bin/python: File or directory not found

$/usr/bin/python -c 'print "hello"'
hello

$python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import os
os.getenv("PATH")
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib:/home/tizen/tizen-sdk/tools'

$echo $PATH
$/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib:/home/tizen/tizen-sdk/tools

Please, can you help me?

@askervin
Copy link
Contributor

The fmbttizen library tries to execute pythonCommand on the emulator / device. If neither of the following launches Python, the problem is that it is not installed on the emulator:

sdb shell python
sdb shell /opt/python/bin/python

Please see issue #18 to find Python RPMs.

@erbett
Copy link
Author

erbett commented Oct 22, 2014

Thank you for your prompt reply.

I installed (on emulator) the files bellow:
libpython-2.7.1-1.4.i586.rpm
python-base-2.7.1-1.4.i586.rpm

The results:
$sdb shell python
Python 2.7.1 (r271:86832, Jul 10 2013, 10:38:32) [GCC] on linux3
Type "help", "copyright", "credits" or "license" for more information.

sdb shell /opt/python/bin/python
-l: /opt/python/bin/python: No such file or directory

For some reason, Python isn't being installed in /opt/python/bin

I'm not sure if it is the correct procedure. Unfortunately, the error message persists:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 179, in init
pythonCommand=pythonCommand)
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 591, in init
self.open()
File "/usr/lib/python2.7/dist-packages/fmbttizen.py", line 667, in open
raise TizenConnectionError('Connecting to a Tizen device/emulator with "sdb -s %s shell" failed.' % (self._serialNumber,))
fmbttizen.TizenConnectionError: Connecting to a Tizen device/emulator with "sdb -s emulator-26101 shell" failed.

@askervin
Copy link
Contributor

Ok, in that case you can drop pythonCommand in the test script, that is, use plain d=fmbttizen.Device(). In my opinion, this would be the correct thing to do, because the only thing this assumes about Python (on the emulator/device) is that it is in PATH. Unfortunately, it turned out at some point, that it is possible to install Python RPMs without python ending up to PATH. Therefore I added pythonCommand to allow launching it from any directory path.

If you need to write code that has to work with both typical Python and "/opt/python/bin/python", I would suggest using

import fmbttizen
try:
    d = fmbttizen.Device()
except fmbttizen.TizenConnectionError:
    d = fmbttizen.Device(pythonCommand="/opt/python/bin/python")

@erbett
Copy link
Author

erbett commented Oct 23, 2014

I'm beginning to suspect that the problem can be with my environment configuration (running Tizen 2.3b in a virtual machine with Ubuntu 14.04).

The issue #18 refers to version 2.2. However, I could install those RPMs in new emulator.

Is it a problem of the new version of Tizen? Please, can you recommend me a stable configuration (environment)?

The project fMBT is very interesting and I'd like to test it.

@askervin
Copy link
Contributor

I installed Tizen 2.3b to Ubuntu 14.04 that runs on a virtual machine. I installed libpython and python-base RPMs from Tizen 2.2 repos. And I'm able to reproduce the issue.

The root cause seems to be that emulator:/tmp/fmbttizen-agent.py cannot connect to the X server (on emulator) when running as a "developer". Try whoami. However, if fmbttizen-agent.py is executed as root, X server accepts the connection.

As a quick solution, I would suggest running sdb root on on the host. After that fmbttizen-agent.py will be executed as root. I got python -c "import fmbttizen; fmbttizen.Device()" working, and fmbt-scripter gives screenshot from the Tizen emulator as expected.

I will see if I could make the root cause of the error visible to the user.

@askervin
Copy link
Contributor

Error messages are now more informative. I also noticed that input devices on Tizen 2.3b emulator differ from those on earlier Tizen emulators. So a patch was needed to get pressBack(), pressHome(), pressMenu(), pressVolumeUp(), pressVolumeDown() working. The patch is now in fMBT devel branch.

Please use fMBT from github devel branch or fMBT packages for Ubuntu from my PPA repo in order to test Tizen 2.3b.

@erbett
Copy link
Author

erbett commented Oct 25, 2014

Yes!!! I followed your instructions and everything is working now.

Thank for your help and patience, Attin. I hope you continue to maintain this excellent work.

@askervin
Copy link
Contributor

Glad to hear that, @ehro. Thanks for your contribution to the project! Closing the issue.

@amazpyel
Copy link

I'm glad to hear about support of Tizen 2.3!

@Rosi061
Copy link

Rosi061 commented Oct 30, 2014

Hi @ehro,
How you installed the rpm files on Tizen.
Every time i try to install rpm files on Tizen device, i got an error message just same as
https://bugs.tizen.org/jira/browse/TC-321

@erbett
Copy link
Author

erbett commented Oct 30, 2014

@Rosi061, my installation was Ubuntu-based. I just followed the instructions described on Tizen website.

Are you using another distro?

@amazpyel
Copy link

my installation was Ubuntu-based. I just followed the instructions described on Tizen website.

@ehro Could you provide a link, please?

@askervin
Copy link
Contributor

@Rosi061, you should be able to install Python rpms by running rpm -i *.rpm as root on the device/emulator.

@erbett
Copy link
Author

erbett commented Oct 31, 2014

Sorry, @Rosi061 and @amazpyel, I made a mistake in my answer. @askervin is correct.

On device/emulator, type "su" to grant root access. Then, install libpython-2.7.1-1.4.i586.rpm and python-base-2.7.1-1.4.i586.rpm. The answer above shows how.

@Rosi061
Copy link

Rosi061 commented Nov 4, 2014

Dear Askervin,
After i enter "rpm -i libpython-2.7.1-1.6.armv7l.rpm", i got the following message
"installing package libpython-2.7.1-1.6.armv7l needs 2MB on the / filesystem"
Can you help me with this?

Thank you.

@madhav-pai
Copy link

Hi,

Please try this

"sdb root on"
"sdb shell"
"change-booting-mode.sh --update"

and let me know if it works for you

Thanks

@Rosi061
Copy link

Rosi061 commented Nov 4, 2014

Hi Madhav,
Thanks ... Thank you so very much.
It solves the problem.

@yuvraj12
Copy link

yuvraj12 commented Aug 31, 2017

Hi Madhav,

Thanks a lot.
It worked for me as also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants