Anyone able to get Micropython working with PyDev and Eclipse on Ubuntu 18.04?

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
scprotz
Posts: 2
Joined: Thu Nov 21, 2019 1:00 am

Anyone able to get Micropython working with PyDev and Eclipse on Ubuntu 18.04?

Post by scprotz » Thu Nov 21, 2019 1:13 am

I installed Micropython on Ubuntu 18.04. I work with Lego EV3s and Micropython is currently our best option for competitive use. When trying to build a development environment, I have Eclipse and PyDev set up on Ubuntu working just fine with Python3. When I try to add Micropython as an interpreter, I get the following error:
See error log for details.
Unable to recreate the Interpreter info (Its format changed. Please, re-create your Interpreter information).Contents found:usage: /snap/micropython/75/usr/local/bin/micropython [<opts>] [-X <implopt>] [-c <command>] [<filename>]
Options:
-v : verbose (trace various operations); can be multiple
-O[N] : apply bytecode optimizations of level N

Implementation specific options (-X):
compile-only -- parse and compile only
emit={bytecode,native,viper} -- set the default code emitter
heapsize=<n>[w][K|M] -- set the heap size for the GC (default 2097152)
Any ideas what I'm doing wrong?

Best I can tell, Micropython does not support -u command line and is making interpreter setup fail.

User avatar
jimmo
Posts: 1678
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Anyone able to get Micropython working with PyDev and Eclipse on Ubuntu 18.04?

Post by jimmo » Thu Nov 21, 2019 3:31 am

Yeah, it's likely the "-u" that's causing a problem. Assuming there's no way to tell PyDev to use different flags, I wonder if you could try wrapping the micropython binary in a shell script that ignored arguments? Otherwise it should be pretty easy to modify ports/unix/main.c to ignore -u (or better yet, implement it).

scprotz
Posts: 2
Joined: Thu Nov 21, 2019 1:00 am

Re: Anyone able to get Micropython working with PyDev and Eclipse on Ubuntu 18.04?

Post by scprotz » Thu Nov 21, 2019 3:54 am

Yep. So did that. Wrote a little bash script i called micropython2.sh

Code: Select all

#!/bin/bash

echo "the first arg is \"$1\""

str1="-u"

if [ "$1" == "$str1" ]
then
	/snap/bin/micropython "${@:2}"
else
	/snap/bin/micropython "$@"
fi

It works, but the python program that eclipse tries to run to generate an XML file of information about the python version fails. Looks like I'd either need to fake the results, write some extra code to assist the eclipse code, or modify the eclipse interpreter loader.

The program is giving me:

Code: Select all

OSError: [Errono 13] EACCES
I think it is because sys.executable doesn't exist. I'll have to see if there is an alternative for that function.

Post Reply