By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,171 Members | 809 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,171 IT Pros & Developers. It's quick & easy.

DDE (eSignal)

P: n/a
I have a Python ap that needs current stock prices, which I want to get
from eSignal's DDE server. Following the win32all example:

import win32ui
import dde
server = dde.CreateServer()
server.Create("eSignalDDE")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("WINROS", "Last")
last = conversation.Request("$spx")
print last

Which almost works. The return in PythonWin is the correct price as a
string with some extra chartacters appended.

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x 12\x00\xfd\x1a\xd9w4\xc1\x00'

Any thoughts on this?

TIA,

jab

Nov 30 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
BBands schrieb:
I have a Python ap that needs current stock prices, which I want to get
from eSignal's DDE server. Following the win32all example:

import win32ui
import dde
server = dde.CreateServer()
server.Create("eSignalDDE")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("WINROS", "Last")
last = conversation.Request("$spx")
print last

Which almost works. The return in PythonWin is the correct price as a
string with some extra chartacters appended.

'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x 12\x00\xfd\x1a\xd9w4\xc1\x00'

Any thoughts on this?

TIA,

jab
Looks like a bug, either in the dde module or the dde server.
But it's easy to find a workaround:
>>'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb \x12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0]
'1402.670000000000'
>>>
Thomas

Nov 30 '06 #2

P: n/a
Thomas Heller wrote:
Looks like a bug, either in the dde module or the dde server.
But it's easy to find a workaround:
'1402.670000000000\x00\x12\x00*\x00\x00\x004\xfb\x 12\x00\xfd\x1a\xd9w4\xc1\x00'.split("\0")[0]
'1402.670000000000'
float(last.split("\0")[0]) works for me.

Thanks for that!

jab

Nov 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.