Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'ctypes.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'googling': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:pass': 0.16; 'wrote:': 0.17; 'alex': 0.17; 'stefan': 0.17; 'suggested': 0.20; 'bit': 0.21; 'ctypes': 0.22; 'posted': 0.22; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'post': 0.28; 'up.': 0.31; 'file': 0.32; 'received:84': 0.32; 'to:addr:python- list': 0.33; 'skip:- 20': 0.34; 'thanks': 0.34; 'received:org': 0.36; 'but': 0.36; "didn't": 0.36; 'method': 0.36; 'subject:: ': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'more': 0.63; 'show': 0.63; 'joy': 0.65; 'reply': 0.66; 'response.': 0.67; 'friday': 0.71; 'forward.': 0.84; 'received:arcor-ip.net': 0.84; 'received:pools.arcor-ip.net': 0.84; 'subject: *': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: How to pass FILE * Date: Sat, 29 Sep 2012 11:19:51 +0200 References: <201209281455.07702.thudfoo@gmail.com> <201209290145.19962.thudfoo@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-028-128.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 In-Reply-To: <201209290145.19962.thudfoo@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348910404 news.xs4all.nl 6979 [2001:888:2000:d::a6]:36554 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30471 xDog Walker, 29.09.2012 10:45: > On Friday 2012 September 28 21:27, you wrote: >> A tiny bit of googling suggests the following approach: >> http://stackoverflow.com/questions/3794309/python-ctypes-python-file-object >> -c-file/3794401#3794401 > > Thanks for your response. > > My "tiny bit of Googling" brought no joy but I did try successfully the same > method suggested by Alex Martelli: use libc's fdopen to get a FILE * for > ctypes. I would have posted a reply to my own post but it didn't show up. Given your second post on stackoverflow, you may also consider switching from ctypes to Cython. It makes these things a bit more straight forward. Stefan