Re: [Pythonmac-SIG] Python completion in emacs fails on OSX

2012-04-17 Thread Ned Deily
In article 87ehrn80aj@gmail.com, Leo sdl@gmail.com wrote:

 It seems the python interpreter built by Apple doesn't behave like the
 ones built from upstream.
 
 See this:
 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#19
 
 Any idea what's happened to python from apple?

Off the top of my head, I suspect the most likely cause to be that the 
Apple system pythons are built with the BSD editline library rather than 
with GNU readline.  You could try installing the third-party readline 
package which replaces the Python standard library readline module 
with one linked with GNU readline. 

http://pypi.python.org/pypi/readline

-- 
 Ned Deily,
 n...@acm.org

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Python completion in emacs fails on OSX

2012-04-17 Thread Leo
On 2012-04-17 15:56 +0800, Ned Deily wrote:
 Off the top of my head, I suspect the most likely cause to be that the 
 Apple system pythons are built with the BSD editline library rather than 
 with GNU readline.  You could try installing the third-party readline 
 package which replaces the Python standard library readline module 
 with one linked with GNU readline. 

 http://pypi.python.org/pypi/readline

I have just tested it and no, it is not due to readline.

Leo

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Python completion in emacs fails on OSX

2012-04-17 Thread Bill Janssen
This is really an Emacs issue, not a Python issue.  I don't even see
where they say they are both using the version of the Python interpreter.

Bill

Leo sdl@gmail.com wrote:

 It seems the python interpreter built by Apple doesn't behave like the
 ones built from upstream.
 
 See this:
 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#19
 
 Any idea what's happened to python from apple?
 
 Leo
 
 ___
 Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
 http://mail.python.org/mailman/listinfo/pythonmac-sig
 unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard

2012-04-17 Thread João Leão
Hi list

I have an old script using the CoreGraphics API that's no longer working 
properly since Snow Leopard.
I' running Lion with the default Python, which is 2.7.1.
I googled about this and it seems that's because Python is 64-bit now and some 
old data types don't work anymore.


The first error I got was in the function CGBitmapContextCreateWithColor.
The Console spits the following error:
---
TypeError: in method 'CGBitmapContextCreateWithColor', argument 4 of type 
'CGFloat const [5]'
---

My code looks like this:
c = CGBitmapContextCreateWithColor(new_Width, new_Height, cs, (0,0,0,0))

The problem is in the last argument (0, 0, 0, 0) [a color reference] which, 
the new API expects to be CGFloatArray.
I couldn't find any documentation on how to create such an object in python 
but, fortunately, I found some code here 
http://stuffineededtoknow.blogspot.pt/2009_01_01_archive.html  that solved this 
issue:
---
bg = CGFloatArray(5)
c = CGBitmapContextCreateWithColor(new_Width, new_Height, cs, bg)
---


But now I'm getting another error (and I'll probably get some more) with 
another function that expects a CGFloat object instead of a plain integer.
The code looks like this:
---
self.pdf.drawPlainTextInRect(text_prov, textRect, 10)
---

And the error (again caused by the last argument, in this case 10):
---
TypeError: in method 'CGContext_drawPlainTextInRect', argument 4 of type 
'CGFloat'
---


I'm sure that it can't be so hard to create a CGFloat but I didn't find the 
right documentation or sample code to do it.
Does anybody know how to do this?

Thanks in advance.
João
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard

2012-04-17 Thread Bill Janssen
João Leão joaol...@gmx.net wrote:

 But now I'm getting another error (and I'll probably get some more) with 
 another function that expects a CGFloat object instead of a plain integer.
 The code looks like this:
 ---
 self.pdf.drawPlainTextInRect(text_prov, textRect, 10)
 ---
 
 And the error (again caused by the last argument, in this case 10):
 ---
 TypeError: in method 'CGContext_drawPlainTextInRect', argument 4 of type 
 'CGFloat'
 ---
 
 
 I'm sure that it can't be so hard to create a CGFloat but I didn't find the 
 right documentation or sample code to do it.
 Does anybody know how to do this?

Did you try self.pdf.drawPlainTextInRect(text_prov, textRect, 10.0)?

Bill
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard

2012-04-17 Thread João Leão
 João Leão joaol...@gmx.net wrote:
 
 But now I'm getting another error (and I'll probably get some more) with 
 another function that expects a CGFloat object instead of a plain integer.
 The code looks like this:
 ---
 self.pdf.drawPlainTextInRect(text_prov, textRect, 10)
 ---
 
 And the error (again caused by the last argument, in this case 10):
 ---
 TypeError: in method 'CGContext_drawPlainTextInRect', argument 4 of type 
 'CGFloat'
 ---
 
 
 I'm sure that it can't be so hard to create a CGFloat but I didn't find the 
 right documentation or sample code to do it.
 Does anybody know how to do this?
 
 Did you try self.pdf.drawPlainTextInRect(text_prov, textRect, 10.0)?

Yes I did, but it didn't work.
Thanks anyway.

 
 Bill

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Python completion in emacs fails on OSX

2012-04-17 Thread Leo
On 2012-04-17 23:27 +0800, Bill Janssen wrote:
 This is really an Emacs issue, not a Python issue.  I don't even see
 where they say they are both using the version of the Python interpreter.

Unthinkable.

I have built python 2.7.3 from upstream and see no such bug. Something
is done to python apple.

Leo

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG