Hi Lou,
Running wxPython 2.9.4, iPython 0.31.1, python 2.7.3, windows 8
The first time I run my script which uses PersistenceManager, within a given
iPython session, wxPython (I think correctly) puts Persistence_Options in
C:\Users\Lou\AppData\Roaming\<scriptname>\ .
But when I run the script a subsequent time in the same iPython session, it
seems to be putting Persistence_Options in C:\Users\Lou\AppData\Roaming\ .
If I exit iPython and start again, C:\...\<scriptname>\ is used again.
I suspect that some state is maintained within the iPython session, which is
preventing PersistenceManager from finding the right directory on the nth
running where n>1.
I tried PersistenceManager.Free() when program exits, but that didn't seem
to help.
Any suggestions?
I am not sure what is going on, I never used IPython. However, what
PersistentManager only does is to fetch the user data directory via:
wx.StandardPaths.Get().GetUserDataDir()
and then join that directory with the "Persistence_Options" file name.
What I found out is that, if you run the above line in a Python
prompt, you get the following (for me):
D:\MyProjects\Phaser\RC04\0.4.9>python
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import wx
app = wx.App(0)
wx.StandardPaths.Get().GetUserDataDir()
u'C:\\Users\\aga108\\AppData\\Roaming\\python'
While if I run it in PythonWin I get this:
wx.StandardPaths.Get().GetUserDataDir()
u'C:\\Users\\aga108\\AppData\\Roaming\\Pythonwin'
So it seems to me that GetUserDataDir() adds the current editor/python
session name to the actual data dir (which is what the documentation
says it should do). It may or may not be related to your problem
directly, but if I were you I would run your script from the command
line and not in a IPython session. Of course I will welcome any
improvements to the way PersistentManager handles where the data is
stored...
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
# ------------------------------------------------------------- #
def ask_mailing_list_support(email):
if mention_platform_and_version() and include_sample_app():
send_message(email)
else:
install_malware()
erase_hard_drives()
# ------------------------------------------------------------- #
···
On 12 December 2012 21:30, Lou King wrote: