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

Ctypes example won't work :(

P: 2
Hi

I currently use python 2.7 and i have a snippet of code that comes out different in two interpreters.
Edit: Would help to post my code ^^
Expand|Select|Wrap|Line Numbers
  1. from ctypes import *
  2. msvcrt = cdll.msvcrt
  3. message_string = "hello world!\n"
  4.  
  5. msvcrt.printf("Testing ctypes printf: {0}".format(message_string))
  6. print ("Python Idle: {0}".format(message_string))              
  7.  


First one is python idle. Win7

>>>
Python Idle: hello world!

>>>

As we can see it completely skips the line with the ctype command.

Now the second interpreter is eclipse. And while using the exact same code I get this:

Python Idle: hello world!

Testing ctypes printf: hello world!


If we compare this to the code it writes the python idle line before it write ctype. But in the code ctype is written before the print command.

This make my head want to explode. I know some python but I really can't wrap my head around this. Please help out, virtual cookies in return! ^^ -o
Feb 7 '12 #1
Share this Question
Share on Google+
1 Reply

P: 1
I came across the same problem when using python ver3.2. Then I thought maybe there's something wrong with the python version for it works well with ver2.5. You may try.
Jul 5 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.