Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: [SOLVED] Saving data between sessions

  1. #11
    Join Date
    Jul 2007
    Location
    The Bavarian Alps
    Beans
    129
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: [SOLVED] Saving data between sessions

    Thank you!

  2. #12
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: [SOLVED] Saving data between sessions

    try '~/.stuff'
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

  3. #13
    Join Date
    Jul 2007
    Location
    The Bavarian Alps
    Beans
    129
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: [SOLVED] Saving data between sessions

    Thank you for that suggestion.
    I tried it with the following result

    fpConf=open(CONFIG_FILE, "w")
    IOError: [Errno 2] No such file or directory: '~/GPSBabelWrapper.conf'

    Calling it ~GPSBabelWrapper.conf doesn't bring an error as doesn't GPSBabelWrapper.conf but as I wrote above both result in the file being written to the actual directory.

    So what am I doing wrong.
    Please help

    Neill

    Using /home/neill/GPSBabelWrapper.conf
    works.

    very strange
    Last edited by NeillHog; November 18th, 2007 at 05:30 PM.

  4. #14
    Join Date
    Jul 2007
    Location
    The Bavarian Alps
    Beans
    129
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Saving data between sessions

    I don`t know if it is relevant but I am using Kubuntu. And I obviously have all rights on my home directory.
    I thought that the tilde was equal to /home/neill

  5. #15
    Join Date
    Mar 2006
    Beans
    323
    Distro
    Ubuntu 6.10 Edgy

    Re: Saving data between sessions

    You need the full path since pythons "open()"-function will not do the "~" -> "/home/<current_user>/" mapping for you.

    I know I have seen some kind of function for getting the current users home directory though. Use that instead. Is probably in the "os" module.

  6. #16
    Join Date
    Jul 2007
    Location
    The Bavarian Alps
    Beans
    129
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Saving data between sessions

    That worked !

    configFile = os.path.expanduser("~") + '/GPSBabelWrapper.conf'

    thanks!

  7. #17
    Join Date
    Mar 2006
    Beans
    323
    Distro
    Ubuntu 6.10 Edgy

    Re: Saving data between sessions

    Quote Originally Posted by NeillHog View Post
    That worked !

    configFile = os.path.expanduser("~") + '/GPSBabelWrapper.conf'

    thanks!
    Or you could make it even easier:

    configFile = os.path.expanduser("~/.gpsbabelwrapper")

    1) Configfiles are normally hidden. Let them start with a dot.
    2) Files in Linux are usually not written with capitalized letters. Do a "ls -d .*" in your home directory and watch how the config files are named. Of the 130 hidden files in my home dir, there is not one single capitalized letter.

    Good luck with your project.

  8. #18
    Join Date
    Jul 2007
    Location
    The Bavarian Alps
    Beans
    129
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: [SOLVED] Saving data between sessions

    OK! Thank you for both tips. It is the friendly, informed, helpfull users that make Ubuntu/Python so much fun.
    T anks
    Neill

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •