sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #40246
[Question #401602]: problem with import .py
New question #401602 on Sikuli:
https://answers.launchpad.net/sikuli/+question/401602
Hi I'm using
Linux debian jessie
sikulix 1.1.0 or 1.1.1(I installed it but when I run 'java -jar sikulix.jar', SikulixIDE 1.1.0 is open)
jython 2.7.0
When I use Sikuli X 1.0, I can run sikuli in command line by 'sikuli-ide -r xxx.sikuli' with other python file like 'send_email.py' which sends email by just put this 'import send_email' in my xxx.sikuli directory.
Now, I need to use sikulix 1.1.0 to use jython 2.7.0 properly(I need to make a post request to an api to upload a file) in my Linux machine. I can run the script with the Sikulix 1.1.0 IDE, but I got error message
'[error] ImportError ( No module named formdata )'
formdata is from http://code.activestate.com/recipes/578668-encode-multipart-form-data-for-uploading-files-via/
and this is my code
=================================================================
import urllib2
import formdata
client_id = "1234"
url = 'http://localhost:9292'
file = '/home/txt.txt'
fields = {'name': 'BOB SMITH'}
files = {'file': {'filename': file, 'content': 'Data here'}}
data, headers = formdata.encode_multipart(fields, files)
request = urllib2.Request('http://localhost:9292/attachments?client_id='+client_id, data=data, headers=headers)
f = urllib2.urlopen(request)
print f.read()
=================================================================
This is the command that I run in the command line
java -jar sikulix.jar -i -r ../sikuli/test.sikuli
[info] runcmd: lsb_release -i -r -s
[error] script [ /home/sikuli/testtest.sikuli ] stopped with error in line 2
[error] ImportError ( No module named formdata )
I put the formdata.py in the test.sikuli which is same directory as test.py.
I wonder why it is not work in command line with Sikulix 1.1.0 because it works in Sikulix 1.1.0 IDE and previous version.
Do I need to get 1.1.1 ?
I got 1.1.1 from http://nightly.sikuli.de/ and when I install it, it says it installs 1.1.1 but when I run the .jar file, it opens 1.1.0 IDE.
Thank you for your help in advance.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.