Discussion Board

Results 1 to 7 of 7

Thread: Renaming file

  1. #1
    Regular Contributor kedarm's Avatar
    Join Date
    Sep 2009
    Posts
    285
    Hi!

    I'm trying to rename a file on my phone from the Python console. Following the instructions given here, I did the following -

    Code:
    >>> import os
    >>> os.rename("C://Python//ball.py", "D://ball.py")
    File <console>, line 1, in >
    OSError: [Errno 22] Invalid argument
    The file (ball.py) definitely exists, as I can access it from -
    Application --> Python --> Run Script --> ball.py

    I don't think this will affect anything, but I am using Python 1.4.5 with the high-capacity shell script.

    Thanks
    Kedar

  2. #2
    Registered User MaRZoCHi's Avatar
    Join Date
    Jul 2009
    Location
    Turkey / Samsun
    Posts
    8
    Rename function must be use same folder.

    C => D This is a Moving.

    Example : C://abc.py -> C://def.py
    | www.python-s60.com |
    ------------------------

    ... For Usefull Python S60 Sources

  3. #3
    Regular Contributor kedarm's Avatar
    Join Date
    Sep 2009
    Posts
    285
    Quote Originally Posted by MaRZoCHi View Post
    Rename function must be use same folder.
    C => D This is a Moving.
    Example : C://abc.py -> C://def.py
    Any idea how to move images?

  4. #4
    Nokia Developer Champion sajisoft's Avatar
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,062
    Quote Originally Posted by kedarm View Post
    Any idea how to move images?
    Try this for copying one file from one location to another :
    Code:
    import e32
    e32.file_copy("C:\\Data\\file.txt","E:\\file.txt")  #first argument is for Target, second is for Source
    If u want to do MOVE FILE operation , then just delete the source file after copying it. Like this :
    Code:
    import e32, os
    e32.file_copy("C:\\Data\\file.txt","E:\\file.txt")
    os.remove("E:\\file.txt")
    Best Regards,
    SajiSoft

  5. #5
    Regular Contributor kedarm's Avatar
    Join Date
    Sep 2009
    Posts
    285
    I tried removing a file from my D drive. I got an error saying "Permission Denied".

    Is the D drive protected from the user? Can only signed applications remove files from the D drive?

    Kedar

  6. #6
    Registered User prakashvel's Avatar
    Join Date
    Oct 2009
    Posts
    7
    Hi Kedar,

    D: is a operating memory space or RAM(Read-Only) Even for
    Z: Fixed memory Space or ROM (Read-only)

    Requesting you to choose E: Memory Card Location and Try it out.It will work.
    Assuming that you are Trying on 5th Edition Device or Nokia N97.

    Thanks and Regards
    Prakash Vel

    Reference: Information got through Mobile Python , Chapter 6 Data Handling.

  7. #7
    Regular Contributor kedarm's Avatar
    Join Date
    Sep 2009
    Posts
    285
    Hi Prakash,

    D: is a operating memory space or RAM(Read-Only) Even for
    Z: Fixed memory Space or ROM (Read-only)
    I've been observing that every time I restart my phone, all the contents in the D drive get erased. Is that it in any way related to this?

Similar Threads

  1. 用VS2003+Carbide_vs_202编译出错
    By vipwx in forum Symbian
    Replies: 3
    Last Post: 2009-01-08, 05:44
  2. PED and signing.
    By IX in forum Python
    Replies: 11
    Last Post: 2008-04-21, 01:15
  3. Problem with ensymble_python2.5-0.26.py in linux
    By tansualpcan in forum Python
    Replies: 2
    Last Post: 2008-04-15, 10:12
  4. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Python
    Replies: 35
    Last Post: 2008-01-17, 09:12
  5. Contacts fields order??
    By timatima in forum Symbian C++
    Replies: 1
    Last Post: 2007-06-08, 13:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved