Problem with python and CoreGraphics

Welcome

I know that this question is not specifically about the pycharm but  i am getting:

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/CoreGraphics/_CoreGraphics.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode

when running this program in pycharm:

from CoreGraphics import *

import random

# Define the mapping between plot coordinates

# and page coordinates

xPlotRange = 5.0

yPlotRange = 5.0

xPageRange = 792.0

yPageRange = 612.0

# Functions

def drawLevelTransition(c, firstLevel,secondLevel):

    # Draw first level

    c.setLineWidth(.01)

    c.beginPath()

    c.moveToPoint(1.0,firstLevel)

    c.addLineToPoint(1.2,firstLevel)

    c.strokePath()

    # Draw second level

    c.beginPath()

    c.moveToPoint(2.0,secondLevel)

    c.addLineToPoint(2.2,secondLevel)

    c.strokePath()

    # Draw dashed line between levels

    c.saveGState()

    c.setLineWidth(.005)

    c.beginPath()

    c.moveToPoint(1.2,firstLevel)

    c.addLineToPoint(2.0,secondLevel)

    c.setRGBStrokeColor(1.,0.,0.,1.0)

    dashes = CGFloatArray(2)

    dashes[0] = 0.1

    dashes[1] = 0.05

    c.setLineDash(0, dashes, 2)

    c.strokePath()

    c.restoreGState()

    # Write text

    c.saveGState()

    c.setRGBFillColor (0,0,1,1)

    c.selectFont ("Helvetica", 0.07, kCGEncodingMacRoman)

    c.setTextPosition(0.5, firstLevel)

    c.setTextDrawingMode (kCGTextFill)

    text = "Level %3.2f" % firstLevel

    c.showText (text, len(text))

    c.restoreGState()

# Create a page to draw in

pageRect = CGRectMake(0, 0, 612, 792)

c = CGPDFContextCreateWithFilename ("energylevels.pdf", pageRect)

c.beginPage(pageRect)

# Apply transform so that we can draw in the plot coordinates

c.scaleCTM(xPageRange/xPlotRange, yPageRange/yPlotRange)

# Draw 5 random transitions for demonstration purposes

for i in range(5):

    first = 5.0 * random.random()

    second = 5.0 * random.random()

    drawLevelTransition(c, first, second)

# Finish off

c.endPage()

c.finish()

###################################

When i type this in console:
export VERSIONER_PYTHON_PREFER_32_BIT=yes
then
>>python
and
>>from CoreGraphics import *
everything is OK but when trying to run program above i still have this error.This is import error.Please help.

PS.
I know that this is important and is related to PyCharm because i have done what is described in man python and in console importing is possible but not in PyCharm.Whats going on with it?

Please sign in to leave a comment.