Jump to content


Photo

Chapter 8 Sd Card Permission Denied


  • Please log in to reply
5 replies to this topic

#1 Jschaefer04

Jschaefer04

    New Member

  • Members
  • Pip
  • 6 posts

Posted 06 March 2013 - 09:32 PM

I'm working on chapter 8. I downloaded the Android SDK, installed it, and managed to set up an ADV. However, when I try to push my droidtest.py script onto the virtual sd card. I get a permission denied error. In DDMS perspective on Eclipse, I try to add the file to the SDCard folder and I get the following two messages. mydroidtest.py was not loaded into SDCard and then the next line simply says null(). From doing a little research on the web, I gather this is a common problem in the latest version of the SDK. I tried a few of the solutions I found via google searches and none of them worked. Even more strange, when I try to use adb via terminal, the folder where the tools are stored is not recognized by my Mac. The folders of the sdk don't even show up when I run the ls command and every time I try to cd over to the folder I get the message 'not a directory from my Mac. I'm really frustrated. Has anyone else run into this? Is there a way to work around it? Any help would be greatly appreciated. Thank you.

#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 07 March 2013 - 02:12 AM

The location of the tools has changed since the book first published (thank you, Google). The "adb" tool can now be found in the "platform-tools" folder on your Mac (as part of the Android SDK). This change is noted on the book's errata (accessible from the book's page on the O'Reilly website). Make sure you copy the mydroidtest.py file into this folder, too, prior to attempting to perform the transfer. Also, the emulator needs to be up-and-running for the transfer to work. You should run the emulator *outside* of Eclipse (as shown in the book). I've never tried any of this in Eclipse as I'd rather eat glass than use that programming environment.

Hope this helps.

--Paul.

#3 Jschaefer04

Jschaefer04

    New Member

  • Members
  • Pip
  • 6 posts

Posted 07 March 2013 - 02:37 AM

Paul,

I already tried moving the mydroidtest.py into platform tools. A big part of the problem is I cannot get to the platform tools folder in terminal. When I try the ccomputer says the folder is not a directory. Also, total new guy question, how do you run this outside of eclipse?

#4 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 07 March 2013 - 09:51 AM

Re-reading page 264 (and the surrounding pages) should help.

Let's assume that you have downloaded the Android SDK into a folder called "Android". Then you can:

- open up a terminal window,
- type "cd Android" to change directory to the SDK's directory.
- type "platform-tools/adb push mydroidtest.py /sdcard/sl4a/scripts" as per the bottom of page 264 (note the change for the new location for the "adb" tool, as well as the requirement for the mydroidtest.py program to be in the "Android" folder).

If the emulator is working (see top of page 264... or open the "tools" folder in the "Android" folder and double-click on "android" to bring up the GUI), you should then see the program appear in the SL4A/Python4Android list.

Hope this helps.

--Paul.

#5 Jschaefer04

Jschaefer04

    New Member

  • Members
  • Pip
  • 6 posts

Posted 07 March 2013 - 04:05 PM

Re-reading page 264 (and the surrounding pages) should help.

Let's assume that you have downloaded the Android SDK into a folder called "Android". Then you can:

- open up a terminal window,
- type "cd Android" to change directory to the SDK's directory.
- type "platform-tools/adb push mydroidtest.py /sdcard/sl4a/scripts" as per the bottom of page 264 (note the change for the new location for the "adb" tool, as well as the requirement for the mydroidtest.py program to be in the "Android" folder).

If the emulator is working (see top of page 264... or open the "tools" folder in the "Android" folder and double-click on "android" to bring up the GUI), you should then see the program appear in the SL4A/Python4Android list.

Hope this helps.

--Paul.


Thanks! I managed to figure out how to run the sdk and adv manager from terminal and I also made an sd card file I could write to. So that problem is fixed.

Now I have my coachapp.py loaded onto the emulated phone but when I run it I get a syntax error from this line in the send_to_server function: return(page.read().decode("utf8")). I have tried changing the spacing, retyping the line, I even swapped the completed file that came in the chapter 8 folder and still get a syntax error on that line. The error highlights the return call itself in red. I can't figure out what the problem was. Any suggestions? Thanks for all your help so far, you've been great :)

Also, I've enclosed a screenshot

Edited by Jschaefer04, 07 March 2013 - 04:06 PM.


#6 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 08 March 2013 - 03:21 AM

The uploaded screenshot is missing?

However, it is important to realize that the coachapp.py program is communicating with the web-server (simplehttpd.py) running on your computer. The two ends of the system have to match up, so be sure the version of coachapp.py you're running is the one that the server code expects you to be running, and vice-versa. Also, if you run the app on the phone under the little terminal icon (not the run-wheel) you can sometimes get better diagnostic messages. This stuff is tricky, not because it is hard, but because it is very fussy. :-(

--Paul.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users