unabe to import /pyd file.

Matt Wheeler m at funkyhat.org
Mon Dec 25 09:13:28 EST 2017


On Fri, Dec 15, 2017, 09:58 <supswain at gmail.com> wrote:

> Hi,
>
> I have created one library file
> "modified_python_automation_tcl.py"..Inside my library file I have set of
> codes as follows.
>
> import sys
> import time
> from datetime import datetime
> import re,sys,os,itertools,datetime,commands,logging,math,time,copy,inspect
> from robot.api import logger
> import unicodedata
> sys.path.append('C:\Python27\Lib\lib-tk')
> sys.path.append('C:\Python27\DLLs')
> sys.path.append('C:\Python27\libs')
>

The fact that you're having to add these paths is the first sign that
something is up, you shouldn't need to add the default paths to sys.path...

from Tkinter import Tcl
> tcl = Tcl()
> .
> .
> .
> .
> .
> .
>
> I am able to run the file from python IDLE.and able to source all kind of
> .py and .pyd file...But the issue is coming when trying through robo
> framework.
>
>
> I am using robo-framework and have defined the
> modified_python_automation_tcl.py  file as the library file. and tryuing to
> excute my testcase..but getting the below error..
>
>
> Someone please help me how to import .pyd files from robo framework
>
> <SNIP>
>
>   C:\PCCAutomation
>   C:\Python27\Lib\lib-tk
>   C:\Python27\DLLs
>   C:\Python27\libs
> CLASSPATH:
>   C:/apache-maven-3.3.9/boot/plexus-classworlds-2.5.2.jar
> Acceptance.Tests.PCC.Automation 2.0.Spirent
>

And here we find the problem. You're running robotframework using the JAR
distribution, right? That means that your Python is Jython, which doesn't
support CPython extensions (i.e. .pyd)

Unfortunately, according to a quick google, there is no support for Tkinter
in Jython at all, so if you need a GUI you'll need to re-write your GUI in
a library that Jython/Java can talk to.

(other possible ways around this could be dropping this
"plexus-classworlds" jar if you can and running robotframework from
CPython* instead, or (in theory) using the robotframework remote library [
https://github.com/robotframework/RemoteInterface] to run the
Java-dependent parts in Jython & the CPython-dependent parts in CPython
(I've not used the remote library myself so don't know how easy it is to
work with, but it should work either way around))

* pip install robotframework

> --

--
Matt Wheeler
http://funkyh.at



More information about the Python-list mailing list