title: IOError: [Errno 13] Permission denied while reading from a Python NamedPipe
body: <p>I've a NamedPipe Server written in Powershell and a NamedPipe Client written in Python. The following is my NamedPipe Client:</p>
  
  <pre><code>def namedpipeClient():
      print "Inside NamedPipeClient"
      time.sleep(2)
      f = open(r'\\x.x.x.x\pipe\testpipe', 'r+b', 0)
      i = 1
      n = struct.unpack('I', f.read(4))[0]    # Read str length
      s = f.read(n)                           # Read str
      f.seek(0)                               # Important!!!
      f.close()
      print 'Read:', s
      if (s is None):
          return True
      else:
          return False
  </code></pre>
  
  <p>I'm starting the NamedPipeServer in C# in one machine, and in another machine I'll be running the NamedPipeClient via a batch file. The following is my batch file runTest.bat</p>
  
  <pre><code>c:
  cd \Python27
  .\python D:\LoadTesting\SikuliNPClient.py
  </code></pre>
  
  <p>So running this way executes everything without any issues.</p>
  
  <p>Now if I try to execute the same batch file in the same machine but remotely from the machine where I'm starting the NamedPipeServer via a psexec, <code>psexec \\$remoteMachine -i 0 -d Powershell D:\LoadTesting\runTest.bat</code> the batch file gets executed, but at the <code>f = open(r'\\x.x.x.x\pipe\testpipe', 'r+b', 0)</code> statement, it throws the following error.</p>
  
  <pre><code>Inside NamedPipeClient
  Traceback (most recent call last):
    File "D:\LoadTesting\SikuliNPClient.py", line 40, in &lt;module&gt;
      namedpipeClient()
    File "D:\LoadTesting\SikuliNPClient.py", line 9, in namedpipeClient
      f = open(r'\\192.168.173.231\pipe\testpipe', 'r+b', 0)
  IOError: [Errno 13] Permission denied: '\\\\x.x.x.x\\pipe\\testpipe'
  </code></pre>
  
  <p>I'm logged in two machines as same users only which have admin privileges as well.
  Kindly help me figure out the issue I've.</p>
  
  <p>Thanks in advance!</p>