title: How to get DDE server to work in python 3?
body: <p>In 2015 I have posted a question on SO how to <a href="https://stackoverflow.com/questions/30152460/create-dde-server-in-python-and-send-data-continuously">Create DDE server in python and send data continously</a>. The answer and code posted by JayleoPlayGround to that question back then worked flawlessly in python 2.7 and I have used it until recently.</p>
  
  <p>As Python 2 is no longer actively supported from January 2020, I want to move my code to python 3. I have installed pywin32 (version 227) using pip on python 3.7.6 and tried to use the same code as before:</p>
  
  <pre><code># coded by JayleoPlayGround
  # use Portable Python 2.7.5.1 + pywin32-214
  
  import time
  import win32ui, dde
  from pywin.mfc import object
  
  
  class DDETopic(object.Object):
      def __init__(self, topicName):
          self.topic = dde.CreateTopic(topicName)
          object.Object.__init__(self, self.topic)
          self.items = {}
  
      def setData(self, itemName, value):
          try:
              self.items[itemName].SetData( str(value) )
          except KeyError:
              if itemName not in self.items:
                  self.items[itemName] = dde.CreateStringItem(itemName)
                  self.topic.AddItem( self.items[itemName] )
                  self.items[itemName].SetData( str(value) )
  
  
  ddeServer = dde.CreateServer()
  ddeServer.Create('Orbitron')
  ddeTopic = DDETopic('Tracking')
  ddeServer.AddTopic(ddeTopic)
  
  while True:
      yourData = time.ctime() + ' UP0 DN145000001 UMusb DMfm AZ040 EL005 SNNO SATELLITE'
      ddeTopic.setData('Tracking', yourData)
      win32ui.PumpWaitingMessages(0, -1)
      time.sleep(0.1)
  </code></pre>
  
  <p>When running the above code in python 3.7.6 and using pywin32 (version 227), the external DDE client application that I interface with is able to connect to the DDE server, but the data string is not received correctly. As described before, if I am using Python 2.7 with pywin32 (version 214) this works fine however.</p>
  
  <p>As there are no error messages shown I am lost what the problem is under python 3. I tried all available pywin32 versions for this python version (222 to 227) without success. Any ideas on how to get this to work would be much appreciated.</p>