Discussion:
Phoenix - lib.agw.persist
Werner
2014-04-10 12:42:45 UTC
Permalink
Hi,

Trying to get this to work on Py3.3 but can't figure out how to fix the
import of persistancemanager in persist_handlers.py.

It hicks up on line 50 "import persistencemanager as PM" with
ImportError "no module persistencemanage".

I tried changing the import to an absolute import but that doesn't help,
could it be a circular import issue?

Anyone has a suggestion on how to fix this?

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Holl
2014-04-10 13:03:12 UTC
Permalink
Spelling error?

persistancemanager vs persistencemanager
Post by Werner
Hi,
Trying to get this to work on Py3.3 but can't figure out how to fix the
import of persistancemanager in persist_handlers.py.
It hicks up on line 50 "import persistencemanager as PM" with ImportError
"no module persistencemanage".
I tried changing the import to an absolute import but that doesn't help,
could it be a circular import issue?
Anyone has a suggestion on how to fix this?
Werner
--
You received this message because you are subscribed to the Google Groups
"wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-04-10 13:11:36 UTC
Permalink
Hi David,
Post by David Holl
Spelling error?
persistancemanager vs persistencemanager
The later is correct spelling.
Post by David Holl
Hi,
Trying to get this to work on Py3.3 but can't figure out how to
fix the import of persistancemanager in persist_handlers.py.
that is just my typo - which I seem to make often:-(
Post by David Holl
It hicks up on line 50 "import persistencemanager as PM" with
ImportError "no module persistencemanage".
I tried changing the import to an absolute import but that doesn't
help, could it be a circular import issue?
Anyone has a suggestion on how to fix this?
Werner
--
You received this message because you are subscribed to the Google
Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-04-10 13:46:02 UTC
Permalink
Hi,

I think I got a solution by moving the import to AbstractHandler, i.e.:

# py3
from . import persistencemanager as PM
self._manager = PM.PersistenceManager.Get()

and change all the:

manager = PM.PersistenceManager.Get()
manager.GetManagerStyle()

to:

self._manager.GetManagerStyle()

Would that be an acceptable change?

The next thing I am not sure how to tackle is:

BAD_DEFAULT_NAMES in persist_constants.py, it starts with a list of some
strings and then uses "eval" to add some others, but these are appended
as bytes, so we have a problem in e.g. PersistentControls demo with this
code:

name = child.GetName()

if name not in PM.BAD_DEFAULT_NAMES and "wxtreelist" not in
name and \
"AuiTabCtrl" not in name:
self._persistMgr.RegisterAndRestore(child)

as GetName() returns a string.

Any suggestion on how to fix that one correctly.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Robin Dunn
2014-04-18 00:30:06 UTC
Permalink
Post by Werner
Hi,
# py3
from . import persistencemanager as PM
self._manager = PM.PersistenceManager.Get()
manager = PM.PersistenceManager.Get()
manager.GetManagerStyle()
self._manager.GetManagerStyle()
Would that be an acceptable change?
I haven't looked much at the rest of the code yet, but from a high level
view I don't see any problems with that change.
Post by Werner
BAD_DEFAULT_NAMES in persist_constants.py, it starts with a list of some
strings and then uses "eval" to add some others, but these are appended
as bytes, so we have a problem in e.g. PersistentControls demo with this
Do you mean this code?:

for name in dir(wx):
if "NameStr" in name:
BAD_DEFAULT_NAMES.append(eval("wx.%s"%name))

I should look and see why those values are being generated as bytes
values instead of strings, but in either case I think it would be okay
to use something like this to fix your issue:

val = getattr(wx, name)
if PY3 and isinstance(val, bytes):
val = val.decode('utf-8')
BAD_DEFAULT_NAMES.append(val)
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-04-19 13:01:55 UTC
Permalink
Hi Robin and hopefully Andrea:),
Post by Robin Dunn
Post by Werner
Hi,
# py3
from . import persistencemanager as PM
self._manager = PM.PersistenceManager.Get()
manager = PM.PersistenceManager.Get()
manager.GetManagerStyle()
self._manager.GetManagerStyle()
Would that be an acceptable change?
I haven't looked much at the rest of the code yet, but from a high
level view I don't see any problems with that change.
It works for me up to now, but I hope Andrea will find a moment to look
at it.
Post by Robin Dunn
Post by Werner
BAD_DEFAULT_NAMES in persist_constants.py, it starts with a list of some
strings and then uses "eval" to add some others, but these are appended
as bytes, so we have a problem in e.g. PersistentControls demo with this
BAD_DEFAULT_NAMES.append(eval("wx.%s"%name))
I should look and see why those values are being generated as bytes
values instead of strings, but in either case I think it would be okay
val = getattr(wx, name)
val = val.decode('utf-8')
BAD_DEFAULT_NAMES.append(val)
I like using getattr better then eval, changed it and updated PR 74.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Gavana
2014-04-20 06:57:19 UTC
Permalink
Hi Werner,
Post by Werner
Hi Robin and hopefully Andrea:),
Post by Robin Dunn
Post by Werner
Hi,
# py3
from . import persistencemanager as PM
self._manager = PM.PersistenceManager.Get()
manager = PM.PersistenceManager.Get()
manager.GetManagerStyle()
self._manager.GetManagerStyle()
Would that be an acceptable change?
I haven't looked much at the rest of the code yet, but from a high level
view I don't see any problems with that change.
It works for me up to now, but I hope Andrea will find a moment to look at
it.
It looks ok to me as well. It's a pity there seems not to be a way to make
the static "Get" work as before but I agree that the import mechanism in
the persist package was a bit unorthodox :-) .

Sorry for the late reply but I'm still without a PC. Luckily I'm getting
one soon since I'm visiting the US in a couple of weeks :-D .

Andrea.
Post by Werner
Post by Robin Dunn
Post by Werner
BAD_DEFAULT_NAMES in persist_constants.py, it starts with a list of some
strings and then uses "eval" to add some others, but these are appended
as bytes, so we have a problem in e.g. PersistentControls demo with this
BAD_DEFAULT_NAMES.append(eval("wx.%s"%name))
I should look and see why those values are being generated as bytes
values instead of strings, but in either case I think it would be okay to
val = getattr(wx, name)
val = val.decode('utf-8')
BAD_DEFAULT_NAMES.append(val)
I like using getattr better then eval, changed it and updated PR 74.
Werner
--
You received this message because you are subscribed to the Google Groups
"wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-04-20 10:12:37 UTC
Permalink
Hi Andrea,

On 4/20/2014 8:57, Andrea Gavana wrote:
...
Post by Andrea Gavana
It looks ok to me as well. It's a pity there seems not to be a way to
make the static "Get" work as before but I agree that the import
mechanism in the persist package was a bit unorthodox :-) .
Great.
Post by Andrea Gavana
Sorry for the late reply but I'm still without a PC. Luckily I'm
getting one soon since I'm visiting the US in a couple of weeks :-D .
No problem.

RE PC from US, I did that once I ended up paying customs when I came
back into Europe, you might want to keep that in mind unless the PC is
purchased by your company in which case there should be no problem.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...