×

Discussion Board

Results 1 to 7 of 7

Thread: Renaming file

  1. #1
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    285

    Renaming file

    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
    Join Date
    Jul 2009
    Location
    Turkey / Samsun
    Posts
    8

    Re: Renaming file

    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
    Join Date
    Sep 2009
    Posts
    285

    Re: Renaming file

    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
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: Renaming file

    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
    Join Date
    Sep 2009
    Posts
    285

    Re: Renaming file

    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
    Join Date
    Oct 2009
    Posts
    7

    Re: Renaming file

    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
    Join Date
    Sep 2009
    Posts
    285

    Re: Renaming file

    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. PED and signing.
    By IX in forum Symbian
    Replies: 11
    Last Post: 2008-04-21, 01:15
  2. Problem with ensymble_python2.5-0.26.py in linux
    By tansualpcan in forum Symbian
    Replies: 2
    Last Post: 2008-04-15, 10:12
  3. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Symbian
    Replies: 35
    Last Post: 2008-01-17, 09:12
  4. Contacts fields order??
    By timatima in forum Symbian
    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
  •  
×