[ome-users] setdn ldap special character
Wood, Christopher
CJW at stowers.org
Wed Aug 31 15:55:45 BST 2011
Josh,
Thanks, that works great!
Chris
-----Original Message-----
From: Josh Moore [mailto:josh at glencoesoftware.com]
Sent: Tuesday, August 30, 2011 3:40 AM
To: Wood, Christopher
Cc: ome-users at lists.openmicroscopy.org.uk
Subject: Re: [ome-users] setdn ldap special character
Hi Chris,
If you want to go from \xc3\xa1 to u'\xe1' then use:
In [2]: unicode('\xc3\xa1', 'utf-8')
Out[2]: u'\xe1'
or
In [3]: str('\xc3\xa1').decode('utf-8')
Out[3]: u'\xe1'
For example:
# setdn.py
import subprocess
subprocess.call(["bin/omero", "ldap", "setdn", "cwood", unicode("\xc3\xa1", "utf-8")]) subprocess.call(["bin/psql", "43d", "-c", "select dn from password where experimenter_id = 2"])
prints:
~/git/dist $ python setdn.py
Using session 51b218ba-0180-45d6-a92c-96b4a1828ed1 (root at localhost:4064). Idle timeout: 10.0 min. Current group: system dn
----
á
(1 row)
To go back again:
In [18]: unicode("\xc3\xa1", "utf-8").encode("utf-8")
Out[18]: '\xc3\xa1'
Cheers,
~Josh.
On Aug 29, 2011, at 10:56 PM, Wood, Christopher wrote:
> Hi,
>
> I use "omero ldap setdn dn" to let users use their regular passwords for Omero. I run a python script to get the distinguished name, and then run the setdn command.
>
> I have a name with a special character, á, that python returns a \xc3\xa1, that I think should be u'\xe1'.
>
> How do I put this into the command line?
>
> Thanks
> Chris
More information about the ome-users
mailing list