Giter VIP home page Giter VIP logo

pyvle's People

Contributors

codidex avatar david-sauvage avatar quesnel avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyvle's Issues

failed to run unit test

$ ctest -VV
Test project /home/goth/git/vle/pyvle/build
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: test_python

1: Test command: /home/goth/git/vle/pyvle/tests/pyvletest.py "/home/goth/git/vle/pyvle/tests"
1: Test timeout computed to be: 9.99988e+06
1: .I/O warning : failed to load external entity "exp/not_existing_file"
1: I/O warning : failed to load external entity "exp/not_existing_file"
1: .Entity: line 1: parser error : Start tag expected, '<' not found
1: not a valid vpz
1: ^
1: ...........I/O warning : failed to load external entity "exp/tmp/tmpRgRnl9"
1: I/O warning : failed to load external entity "exp/tmp/tmpRgRnl9"
1: F.................
1: ======================================================================
1: FAIL: testSaveInFilename (pyvle_experiment.TestExperiment)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1: File "/home/goth/git/vle/pyvle/tests/pyvle_experiment.py", line 71, in testSaveInFilename
1: self.assertIsInstance(exp_test.vpz, libpyvle.Vpz)
1: AssertionError: None is not an instance of <class 'libpyvle.Vpz'>
1:
1: ----------------------------------------------------------------------
1: Ran 31 tests in 0.083s
1:
1: FAILED (failures=1)
1/1 Test #1: test_python ...................... Passed 1.24 sec

100% tests passed, 0 tests failed out of 1

Using python 2 or python 3

On linux systems (at least ubuntu) one can use either python 2.7 or 3.x.
Pyvle relies on boost.python. This lib comes with 2 versions (for python 2 and 3) of the .so but I can find only one include version (/usr/include/boost/python.hpp) which is for python 2.7 version. I did not succeed in compiling pyvle for python 3.x.
Maybe something is missing ?

Could other alternatives (hpp only) be usefull such as pybind11 or SWIG ?

Migratin to python 3

Using python 3. I get this error :

/pub/src/vledev/pyvle/src/convert.cpp:89:18: error: ‘PyInstance_New’ was not declared in this scope
result = PyInstance_New(class_, args, NULL);
^~~~~~~~~~~~~~
/pub/src/vledev/pyvle/src/convert.cpp:89:18: note: suggested alternative: ‘PyAsyncGen_New’

Except I cannot find any documentation on PyAsyncGen_New for python 3.

windows compilation fails to load and use Vpz file

Hi,
I tried to use pyvle successfully compiled on windows with Boost 1 70 and gcc/g++ shipped with VLE 2.0.2. Import in python 2.7.16 works well too, but opening a vpz file buigs and leads to a fatal error when calling listConditions. Different formats where tested for vpz file (unix, dos, utf-8 with and without BOM...) which is successfully created and managed by VLE 2.0.2 gui on Windows.

Where can be the error in Vpz reading ? A failure in xml parsing ? VLE dll used in compilation comes with VLE 2.0.2 application...

Thanks for any clue.

Python screen capture :

Microsoft Windows [version 10.0.18362.720]
(c) 2019 Microsoft Corporation. Tous droits réservés.

Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:30:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import pyvle
from pyvle import Vle
dir(pyvle.Vle)
['doc', 'init', 'module', 'addBooleanCondition', 'addEventView', 'addFinishView', 'addIntegerCondition', 'addMapCondition', 'addMatrixCondition', 'addObservable', 'addObservablePort', 'addRealCondition', 'addSetCondition', 'addStringCondition', 'addTableCondition', 'addTimedView', 'addTupleCondition', 'addValueCondition', 'addXMLCondition', 'clearConditionPort', 'clearObservables', 'createCondition', 'delConditionValue', 'delObservable', 'delObservablePort', 'existObservable', 'export', 'exportManager', 'getBegin', 'getConditionPortValue', 'getConditionPortValues', 'getConditionSetValue', 'getConditionValueType', 'getDuration', 'getDynamicLanguage', 'getDynamicLibrary', 'getDynamicModel', 'getDynamicName', 'getExperimentName', 'getObservableName', 'getObservablePortAttachedViews', 'getObservablePortName', 'getOutputLocation', 'getOutputPlugin', 'getViewData', 'getViewName', 'getViewOutput', 'getViewTimeStep', 'getViewType', 'hasObservableView', 'isObservablesEmpty', 'isPermanentObservable', 'listAtomicModelConditions', 'listConditionPorts', 'listConditions', 'listDynamicConditions', 'listDynamicModels', 'listDynamicObservables', 'listDynamics', 'listObservablePorts', 'listObservables', 'listOutputs', 'listViews', 'listViewsEntries', 'run', 'runCombination', 'runManager', 'runManagerCluster', 'runManagerClusterMatrix', 'runManagerMatrix', 'runManagerThread', 'runManagerThreadMatrix', 'runMatrix', 'save', 'setBegin', 'setConditionPortValue', 'setConditionValue', 'setDuration', 'setDynamicLanguage', 'setDynamicLibrary', 'setDynamicModel', 'setName', 'setNormalMode', 'setOutputPlugin', 'setPackageMode', 'setPermanentObservable', 'setViewData', 'setViewName', 'setViewTimeStep', 'setViewType', 'traceRunError']
f = Vle("NewVpz.vpz")
debug: Environment
debug: =::=::
debug: =C:=C:\Users\icido\vle\projets\tuto1\lotkavolterra\exp
debug: =F:=F:
debug: ALLUSERSPROFILE=C:\ProgramData
debug: APPDATA=C:\Users\icido\AppData\Roaming
debug: CMAKE_INCLUDE_PATH=D:\NedelecDev\32bits\python27\include;D:\NedelecDev\32bits\boost_1_72_0;C:\Program Files (x86)\VLE_2_0_2\include\vle-2.0
debug: CMAKE_MODULE_PATH=C:\Program Files (x86)\VLE_2_0_2\bin
debug: CommonProgramFiles=C:\Program Files (x86)\Common Files
debug: CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
debug: CommonProgramW6432=C:\Program Files\Common Files
debug: COMPUTERNAME=LAPTOP-IDA4G5R0
debug: ComSpec=C:\WINDOWS\system32\cmd.exe
debug: DriverData=C:\Windows\System32\Drivers\DriverData
debug: FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
debug: FPS_BROWSER_USER_PROFILE_STRING=Default
debug: GameFirst=C:\Program Files (x86)\ASUS\GameFirst V
debug: GDAL_DATA=C:\Program Files\PostgreSQL\12\gdal-data
debug: HOMEDRIVE=C:
debug: HOMEPATH=\Users\icido
debug: LOCALAPPDATA=C:\Users\icido\AppData\Local
debug: LOGONSERVER=\LAPTOP-IDA4G5R0
debug: MOZ_PLUGIN_PATH=C:\Program Files (x86)\Foxit Software\Foxit Reader\plugins
debug: NUMBER_OF_PROCESSORS=12
debug: OneDrive=C:\Users\icido\OneDrive
debug: OS=Windows_NT
debug: PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
debug: PKG_CONFIG_PATH=C:\Program Files (x86)\VLE_2_0_2\lib\pkgconfig
debug: POSTGIS_ENABLE_OUTDB_RASTERS=1
debug: POSTGIS_GDAL_ENABLED_DRIVERS=GTiff PNG JPEG GIF XYZ DTED USGSDEM AAIGrid
debug: PROCESSOR_ARCHITECTURE=x86
debug: PROCESSOR_ARCHITEW6432=AMD64
debug: PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
debug: PROCESSOR_LEVEL=6
debug: PROCESSOR_REVISION=9e0a
debug: ProgramData=C:\ProgramData
debug: ProgramFiles=C:\Program Files (x86)
debug: ProgramFiles(x86)=C:\Program Files (x86)
debug: ProgramW6432=C:\Program Files
debug: PROMPT=$P$G
debug: PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
debug: PUBLIC=C:\Users\Public
debug: SESSIONNAME=Console
debug: SystemDrive=C:
debug: SystemRoot=C:\WINDOWS
debug: TEMP=C:\Users\icido\AppData\Local\Temp
debug: TMP=C:\Users\icido\AppData\Local\Temp
debug: USERDOMAIN=LAPTOP-IDA4G5R0
debug: USERDOMAIN_ROAMINGPROFILE=LAPTOP-IDA4G5R0
debug: USERNAME=icido
debug: USERPROFILE=C:\Users\icido
debug: VLE_BASEPATH=C:\Program Files (x86)\VLE_2_0_2
debug: windir=C:\WINDOWS
print(f)
<pyvle.Vle instance at 0x03185328>
f.listConditions()
Assertion failed!

Program: D:\NedelecDev\32bits\python27\python.exe
File: D:\NedelecDev\pyvle-master2.0\src\pyvle.cpp, Line 544

Expression: file

And Python exits there...

2CV simulation ends with SIGSEGV

with pyvle 1.1.2 and 2CV from recordb from master

userPrompt:~/tests> python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pyvle
f = pyvle.Vle("2CV-parcelle.vpz", "2CV")
f.run()
Segmentation fault (core dumped)

debugging with gdb
Program received signal SIGSEGV, Segmentation fault.
pyvle_convert_dataframe (out=...) at /usr/include/c++/4.8/bits/stl_map.h:330
330 { return _M_t.begin(); }
(gdb) quit

Error compiling pyvle

I get this error when compiling pyvle :

/pub/src/vledev/pyvle/src/convert.cpp:52:18: error: ‘PyInt_FromLong’ was not declared in this scope
result = PyInt_FromLong(
^~~~~~~~~~~~~~
/pub/src/vledev/pyvle/src/convert.cpp:52:18: note: suggested alternative: ‘PyLong_FromLong’

I try to compile pyvle with :

  • Ubuntu 18.04
  • vle master
  • Python 2.7.15rc1
  • libboost-python1.65-dev

<nil> values in runManager and runManagerMatrix results

Example in case of :
exp = Vle( "smartgardener.vpz", "vle.examples")
output = exp.getViewOutput("view")
exp.setOutputPlugin(output, '', 'local', 'storage', 'vle.output')

exp.setDuration(3)

exp.runManagerMatrix() and exp.runManager() are OK as is (each parameter has only one value), but when at least one parameter has more than one value (2 values in cond_params.a here) :
exp.clearConditionPort("cond_params","a")
exp.addRealCondition("cond_params","a",0.5)
exp.addRealCondition("cond_params","a",0.51)
Then for exp.runManagerMatrix() and exp.runManager() : unexpected (?) values appears in the result (at the end of each simulation).

vpz without any view in storage mode

Execution:

exp = pyvle.Vle( "smartgardener.vpz", "vle.examples" )
exp.run()
Segmentation fault

is not ok, whereas

exp = pyvle.Vle( "smartgardener.vpz", "vle.examples" )
exp.setOutputPlugin("view","","local","storage","vle.output")
exp.run()

is ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.