1

I'm using Mac OS X Version 10.7.4 and Python 3.2.3. I've read through many of the equally frustrated posts on Stack Overflow, this one was especially useful in helping me delete EasyTether after it didn't work, and turns out was blocking PDANet from working:

OS X 10.6.6 and "adb devices" fails to list android devices

I'm using Paul Ferrill's "Pro Android Python with SL4A" and for the past 4 hours I've just wanted to be able to type the following in my Mac's IDLE session:

>>>import android
>>>droid = android.Android()
>>>droid.makeToast("Hello Android from Mac")

I'm pretty stymied at this point. I've allowed USB debugging on my Samsung Galaxy 4g, I finally have the PDANet software working, but I have nothing to show for it. I've watched a bunch of Youtube tutorials, this one was helpful for installing PDANet:

http://www.youtube.com/watch?v=yR9GANNKUgo

A lot of other people had similar trouble with EasyTether, but now that I have PDANet working, I still can't seem to get this code to work. Right now, my I have the following:

Python 3.2.3 Type "copyright", "credits" or "license()" for more information.

import android

Traceback (most recent call last):

File "", line 1, in

import android

ImportError: No module named android

I would be so very thankful for any help you can provide.

Correction

I understand that the reason the code throws an error is that the android module is not found on my computer. I'm simply wondering how I can get my Mac to connect with my Samsung Galaxy such that I can write the above code and have the file android.py that is on my android register with my script on my Mac, such that the program works.

Community
  • 1
  • 1
user7186
  • 449
  • 1
  • 4
  • 14

3 Answers3

0

I'm not sure if that book is great for Python 3. There is a Python3 APK(http://code.google.com/p/python-for-android/downloads/detail?name=Python3ForAndroid_r6.apk), but the other one, the standard PythonForAndroid is 2.6(?) based. You need to use the same version of python across both your android device and your local machine for what you're trying to do. I'm not sure which Python 3 ve

When I was playing with this and the same book, I had to install the same version of python on my local machine that was used in the APK I installed on my device. It was still a lot of screwing around to get it to work and wasn't really worth the effort in the end.

However, I found that just pushing the script across and instantly running it was way easier than trying to play with IDLE remotely. This is now how I rapidly prototype any Android apps I'm planning to work on.

bms
  • 158
  • 11
  • What do you mean by "just pushing the script across and instantly running it?" How would i go about that? – user7186 Oct 05 '12 at 01:36
  • Do you mean just write the code in Android initially? And if I have a lot of code written on my Mac already, how can I easily upload that on the phone? Thanks so much! – user7186 Oct 05 '12 at 01:39
  • Yep, adb has you covered. You can copy any files from your computer to your phone using it. So, I put mine into the script directory that is used by SL4A so I can use the SL4A menu to execute my scripts. http://developer.android.com/tools/help/adb.html has all the information you need. So, something like `adb -d push /path/to/android/script /path/to/the/SL4A/script/dir` pushed the script right into there and with the right device configuration, you can use `adb -d shell ` to run your script. So, I created a deployment script that pushes and then runs the desired script. – bms Oct 05 '12 at 03:39
0

I had problems connecting my Samsung Galaxy 3 using PDANet to tether to my laptop for internet connection.The phone showed that PDANet was connected as did the laptop and I had taken all the necessary steps (ie: USB debugging enabled) However within seconds the laptop would show the connection was dropped. I finally ran acrross a post that mentioned something about Samsung driver updates. So I went to the Official Samsung website and put in the necessary information regarding my particular cell phone and downloaded the necessary Samsung drivers on to my laptop. I'm happy to say the Samsung Galaxy S3 now tethers perfectly using PDANet which I'm using now to write this post. I hope this information is helpful.

Renjith K N
  • 2,613
  • 2
  • 31
  • 53
0

This free open source project called (gnirehtet) will allow you to do all kinds of theathering of your android phone to a Mac, Linux or Windows computer! The minimum version of android is 5.0 (marshmallow)

enter image description here

Gabriel Fair
  • 4,081
  • 5
  • 33
  • 54