SyntaxError: invalid syntax while building z3 - z3

I downloaded z3 source codes from the master branch and tried to build it, which resulted in the following error:
c:\Program Files\z3>python --version
Python 3.3.2
c:\Program Files\z3>python scripts\mk_make.py
Traceback (most recent call last):
File "scripts\mk_make.py", line 9, in <module>
from mk_util import *
File "c:\Program Files\z3\scripts\mk_util.py", line 81
print "dos2unix '%s'" % fname
^
SyntaxError: invalid syntax
Am I doing something wrong?

The master branch only works with Python 2.7.x.
The unstable (working-in-progress) branch should work with Python 3.x.
Here are instructions to compile the working-in-progress branch.

Related

How to invoke conan in docker container by jenkins? error Failed to execute script conan

Using Docker as a build environment, My jenkinsfile starting specified docker container and invoking CMake which trigger build process using conan and so on. Unfortunately pipeline failed with the following output:
-- Conan: checking conan executable
-- Conan: Found program /usr/bin/conan
-- Conan: Version found [148] Failed to execute script conan
Traceback (most recent call last):
File "conan/conans/conan.py", line 11, in <module>
File "conan/conans/conan.py", line 7, in run
File "conan/conans/client/command.py", line 2151, in main
File "conan/conans/client/conan_api.py", line 222, in factory
File "conan/conans/client/conan_api.py", line 234, in __init__
File "conan/conans/client/migrations.py", line 26, in __init__
File "conan/conans/client/cache/cache.py", line 78, in __init__
File "conan/conans/client/cache/cache.py", line 150, in config
File "conan/conans/util/files.py", line 190, in save
FileNotFoundError: [Errno 2] No such file or directory: '/.conan/conan.conf'
-- Conan executing: /usr/bin/conan install . -s build_type=Release -s compiler=clang -s compiler.version=10 -s compiler.libcxx=libstdc++11 -g=cmake --build=missing
[176] Failed to execute script conan
Traceback (most recent call last):
I do not know what the problem is. If I start container and build it manually it works.
If I create it manually then I am getting following error:
Conan: Version found ERROR: Can't write version file in /.conan/version.txt
I added the following environment variable to my jenkinsfile. Then it simply works!. I was trying to define env variables in docker container that was my fail
environment {
CONAN_USER_HOME = "${env.WORKSPACE}/"
CONAN_NON_INTERACTIVE = 1
}

Drake - Frame visualization attribute error

Running the example /examples/kuka_iiwa_arm/kuka_simulation gives me the following error:
Blockquote
Traceback (most recent call last):
File "/home/felix/.cache/bazel/_bazel_felix/6a5b9f62883c4665b1f398a636821629/external/drake_visualizer/lib/python2.7/site-packages/director/lcmUtils.py", line 117, in handleMessage
callback(msg, channel=channel)
File "/home/felix/git/drake/bazel-bin/tools/drake_visualizer.runfiles/drake/tools/workspace/drake_visualizer/plugin/show_frame.py", line 93, in _handle_message
frame_channel.handle_message(msg)
File "/home/felix/git/drake/bazel-bin/tools/drake_visualizer.runfiles/drake/tools/workspace/drake_visualizer/plugin/show_frame.py", line 36, in handle_message
vis.updateFrame(transform, name, parent=folder, scale=0.1)
File "/home/felix/.cache/bazel/_bazel_felix/6a5b9f62883c4665b1f398a636821629/external/drake_visualizer/lib/python2.7/site-packages/director/visualization.py", line 879, in updateFrame
obj.copyFrame(frame)
AttributeError: 'ContainerItem' object has no attribute 'copyFrame'
Example was started with:
bazel-bin/tools/drake_visualizer &
./bazel-bin/examples/kuka_iiwa_arm/kuka_simulation
bazel-bin/lcmtypes/drake-lcm-spy shows that the channel DRAKE_DRAW_FRAMES is up and messages are being transmitted.
Information about my system:
Operating system: Ubuntu 18.04
gcc: gcc (Ubuntu 7.4.0-9ubuntu1~18.04.york0) 7.4.0
python: Python 2.7.15+ // This is the default python version
bazel run #drake//common:print_host_settings: gcc (Ubuntu 7.4.09ubuntu1~18.04.york0) 7.4.0
cmake: 3.15.4
drake was built from source using bazel 0.29.0
If I run
bazel-bin/tools/drake_visualizer &
./bazel-bin/manipulation/util/geometry_inspector ./manipulation/models/iiwa_description/sdf/iiwa14_no_collision.sdf
The Kuka arm is shown in the visualizer and I can use the sliders to control the configuration of the arm.
Edit: My problem is that when I run /examples/kuka_iiwa_arm/kuka_simulation, no frames are displayed in the visualizer.
This should be fixed once we update the version of Director shipped with Drake.
We're already in the process of doing so via our Python 3 update: https://github.com/RobotLocomotion/drake/issues/12046
Thanks for reporting this!

DSSP from Biopython throwing an error 'NameError: global name 'FileNotFoundError''

I'm trying to run DSSP through Biopython, a couple of months ago the code worked, however, I now get this erroe. Any help would be much appreciated.
>>>from Bio.PDB.PDBParser import PDBParser
>>>from Bio.PDB.DSSP import DSSP
>>>p=PDBParser(PERMISSIVE=1)
>>>st= p.get_structure('1bzq','1bzqK.pdb')
>>>model=st[0]
>>>dssp= DSSP(model,'1bzqK.pdb',dssp='dssp')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rennes/akhila/.local/lib/python2.7/site-packages/Bio/PDB/DSSP.py", line 355, in __init__
except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
I have checked the path of dssp also by
user#home:~/Documents/FR_distances$ mkdssp
mkdssp 2.2.1 options:
-h [ --help ] Display help message
-i [ --input ] arg Input file
-o [ --output ] arg Output file, use 'stdout' to output to screen
-v [ --verbose ] Verbose output
--version Print version
-d [ --debug ] arg Debug level (for even more verbose output)
I have also referred to this and changed the dssp path, but still it gives me the same error.
From source code:
Note that the recent DSSP executable from the DSSP-2 package was
renamed from dssp to mkdssp. If using a recent DSSP release, you
may need to provide the name of your DSSP executable:
>>> dssp = DSSP(model, '1mot.pdb', dssp='mkdssp')
Try replacing dssp= DSSP(model,'1bzqK.pdb',dssp='dssp') by:
dssp = DSSP(model, '1bzqK.pdb', dssp='mkdssp')

Can't run catkin_make, can't resolve UnicodeDecodeError

this is driving me crazy, I already tried a lot of things,e.g. changing locale, but still getting this after workspace init and then doing catkin_make on subdir.
Running on a recent arch dist, ros-indigo, python2.7 and python 3.5 installed
johnny#localhost:~/ros$ catkin_make
Base path: /home/johnny/ros
Source space: /home/johnny/ros/src
Build space: /home/johnny/ros/build
Devel space: /home/johnny/ros/devel
Install space: /home/johnny/ros/install
####
#### Running command: "cmake /home/johnny/ros/src -DCATKIN_DEVEL_PREFIX=/home/johnny/ros/devel -DCMAKE_INSTALL_PREFIX=/home/johnny/ros/install -G Unix Makefiles" in "/home/johnny/ros/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/johnny/ros/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using default Python package layout
-- Using empy: /usr/lib/python2.7/site-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/johnny/ros/build/test_results
-- Found gtest: gtests will be built
CMake Warning at /opt/ros/indigo/share/catkin/cmake/test/nosetests.cmake:96 (message):
nosetests not found, Python tests can not be run (try installing package
'python3-nose')
Call Stack (most recent call first):
/opt/ros/indigo/share/catkin/cmake/all.cmake:147 (include)
/opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:52 (find_package)
-- catkin 0.6.18
-- BUILD_SHARED_LIBS is on
/opt/ros/indigo/share/catkin/cmake/em/order_packages.cmake.em:23: error: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 205: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/em.py", line 3302, in <module>
if __name__ == '__main__': main()
File "/usr/lib/python2.7/site-packages/em.py", line 3300, in main
invoke(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/em.py", line 3283, in invoke
interpreter.wrap(interpreter.file, (file, name))
File "/usr/lib/python2.7/site-packages/em.py", line 2295, in wrap
self.fail(e)
File "/usr/lib/python2.7/site-packages/em.py", line 2284, in wrap
callable(*args)
File "/usr/lib/python2.7/site-packages/em.py", line 2359, in file
self.safe(scanner, done, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 2401, in safe
self.parse(scanner, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 2421, in parse
token.run(self, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 1425, in run
interpreter.execute(self.code, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 2595, in execute
_exec(statements, self.globals, locals)
File "<string>", line 17, in <module>
File "/usr/lib/python2.7/site-packages/catkin_pkg/topological_order.py", line 111, in topological_order
for path, package in find_packages(space).items():
File "/usr/lib/python2.7/site-packages/catkin_pkg/packages.py", line 83, in find_packages
packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings)
File "/usr/lib/python2.7/site-packages/catkin_pkg/packages.py", line 110, in find_packages_allowing_duplicates
packages[path] = parse_package(os.path.join(basepath, path), warnings=warnings)
File "/usr/lib/python2.7/site-packages/catkin_pkg/package.py", line 370, in parse_package
return parse_package_string(f.read(), filename, warnings=warnings)
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 205: ordinal not in range(128)
CMake Error at /opt/ros/indigo/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/home/johnny/ros/build/catkin_generated/env_cached.sh
"/usr/bin/python" "/usr/lib/python2.7/site-packages/em.py" "--raw-errors"
"-F" "/home/johnny/ros/build/catkin_generated/order_packages.py" "-o"
"/home/johnny/ros/build/catkin_generated/order_packages.cmake"
"/opt/ros/indigo/share/catkin/cmake/em/order_packages.cmake.em") returned
error code 1
Call Stack (most recent call first):
/opt/ros/indigo/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
/opt/ros/indigo/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand)
CMakeLists.txt:63 (catkin_workspace)
-- Configuring incomplete, errors occurred!
See also "/home/johnny/ros/build/CMakeFiles/CMakeOutput.log".
See also "/home/johnny/ros/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed'
Thank you very much!
It looks like an unicode problem. In very brief summary, you have passed something that is being interpreted as a string of bytes to something that needs to decode it into Unicode characters, but the default codec (ascii) is failing.
More on this here.
there's a lot of solutions to this one. the one I suggest is doing this :
yassin#pc:/usr/local/lib/python2.7/site-packages# cat sitecustomize.py
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
and to check if that works, you need to do the following :
yassin#pc:~/home# python
Python 2.7.6 (default, Dec 6 2013, 14:49:02)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> reload(sys)
<module 'sys' (built-in)>
>>> sys.getdefaultencoding()
'utf8'
>>>
Hope it helps ! Cheers.
Set the system default locale to en_IN.utf8 should solve the problem.
For example, if you use bash, you can add below lines into your ~/.bashrc:
LANG=en_IN.utf8
export LANG
The catkin toolkit use system default locale to load message or service files.

error compiling the opencv framework

I'm trying to start learning OpenCV but I can`t even create the framework.
I'm using this command like the instructions said
python opencv/ios/build_framework.py ios
But I'm getting the following error:
** BUILD FAILED **
The following build commands failed:
Libtool /Users/myName/Documents/Apps/Frameworks/ios2/build/iPhoneSimulator-i386/modules/world/UninstalledProducts/libopencv_world.a normal i386
(1 failure)
Traceback (most recent call last):
File "opencv/ios/build_framework.py", line 129, in <module>
build_framework(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")), os.path.abspath(sys.argv[1]))
File "opencv/ios/build_framework.py", line 121, in build_framework
put_framework_together(srcroot, dstroot)
File "opencv/ios/build_framework.py", line 89, in put_framework_together
shutil.copytree(tdir0 + "/install/include/opencv2", dstdir + "/Headers")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 168, in copytree
OSError: [Errno 2] No such file or directory: '../build/iPhoneOS-armv7/install/include/opencv2'
I don't know what to do! Please help
Try this:
$ git checkout 2.4.3 # or 2.4.4 or 2.4.3.1 or 2.4.3.2
...somewhere in your opencv checkout before you run
$ python ./build_framework.py <SOME_DIR_OUTSIDE_OF_OPENCV_SOURCE_TREE>

Resources