<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcpy.listusers(workspace) not giving consistent results in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493322#M38702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, we also worked out why this user was missing the version number from the listUser results, it turns out this user was running arcMap 10.2.2, not 10.3 like all other users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems obvious now we think about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Apr 2015 22:56:47 GMT</pubDate>
    <dc:creator>BenVan_Kesteren1</dc:creator>
    <dc:date>2015-04-30T22:56:47Z</dc:date>
    <item>
      <title>arcpy.listusers(workspace) not giving consistent results</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493318#M38698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been running the below line in python, trying to build a list of PC numbers that I can use elsewhere in my script. As PC numbers/names can vary in length I have to modify the output of arcpy.listUsers() to clip the version name which is appended to the ClientName part of the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So to clarify what I am doing:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
current_users = arcpy.ListUsers(r'Database Connections\GISADMIN@SDE_Spatial@Smithy.sde')

for user in current_users:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print user&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this outputs my users currently connected to the DB, this is an example output:&lt;/P&gt;&lt;P&gt;user(ClientName=u'ACC5283-12:10.3.0.1823', ConnectionTime=datetime.datetime(2015, 4, 27, 12, 21, 48, 1), ID=66566, IsDirectConnection=True, Name=u'GISADMIN')&lt;/P&gt;&lt;P&gt;user(ClientName=u'ACC5285-12:10.3.0.1823', ConnectionTime=datetime.datetime(2015, 4, 27, 13, 13, 17), ID=66589, IsDirectConnection=True, Name=u'"ALBURY\\KERRIERO"')&lt;/P&gt;&lt;P&gt;user(ClientName=u'ACC5623-12:10.3.0.1823', ConnectionTime=datetime.datetime(2015, 4, 27, 13, 36, 35), ID=66594, IsDirectConnection=True, Name=u'"ALBURY\\KADENBR"')&lt;/P&gt;&lt;P&gt;user(ClientName=u'ACC5279-12', ConnectionTime=datetime.datetime(2015, 4, 27, 14, 16, 21), ID=66599, IsDirectConnection=True, Name=u'"ALBURY\\PATREAON"')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in order for my script to work I have to make all the ClientNames similar, so what I need is basically 'ACCXXXX-12', and cut off the rest of the clientName which I believe is the version the user is running. Normally I would simply do&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print user.ClientName[:-12]&lt;/PRE&gt;&lt;P&gt;and this would be fine, but as the ClientName is not consistent it is breaking my code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See in my output, the user PatreaON (PC name is ACC5279-12), it for some unknown reason does not include the version number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And that is my problem, is anyone able to tell me why this users output is different to everybody elses?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S unfortunately I cannot simply use user.ClientName[0:10] as the pc numbers range from 0-6000, meaning varying length, and ACC is for my current site, this also varies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas as to why this user is different?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493318#M38698</guid>
      <dc:creator>BenVan_Kesteren1</dc:creator>
      <dc:date>2021-12-11T21:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.listusers(workspace) not giving consistent results</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493319#M38699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excuse the brevity, using my phone to reply. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the split() method i.e user.ClientName.split(':')[0]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 08:33:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493319#M38699</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2015-04-27T08:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.listusers(workspace) not giving consistent results</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493320#M38700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks luke, I have not used that one before, I will give that one a go!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;May I ask what happens if the character ':' is not within the specified string?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Works great for what I wanted. As I want everything preceding the colon,&amp;nbsp; it works. If I need to return anything after (eg. user.ClientName.split(':')[1]) it errors out as soon as a string is found that does not contain a colon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 22:40:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493320#M38700</guid>
      <dc:creator>BenVan_Kesteren1</dc:creator>
      <dc:date>2015-04-27T22:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.listusers(workspace) not giving consistent results</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493321#M38701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try:version = user.ClientName.split(':')[1]&lt;BR /&gt;except IndexError:version = ''&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 23:04:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493321#M38701</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2015-04-27T23:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.listusers(workspace) not giving consistent results</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493322#M38702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, we also worked out why this user was missing the version number from the listUser results, it turns out this user was running arcMap 10.2.2, not 10.3 like all other users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems obvious now we think about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 22:56:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listusers-workspace-not-giving-consistent/m-p/493322#M38702</guid>
      <dc:creator>BenVan_Kesteren1</dc:creator>
      <dc:date>2015-04-30T22:56:47Z</dc:date>
    </item>
  </channel>
</rss>

