Comments (4)
from ghpythonremote.
Thank you for your quick reply!
I did what you suggest, but it shows another warning:
_Runtime error (Exception): type() argument 1 must be string, not unicode
Traceback:
line 102, in value, "C:\Users\20204895\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\async_.py"
line 469, in sync_request, "C:\Users\20204895\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\protocol.py"
line 76, in syncreq, "C:\Users\20204895\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\netref.py"
line 253, in __call__, "C:\Users\20204895\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rpyc\core\netref.py"
line 18, in script_
line 18 is : q = sp.symbols('q', cls=Function)
I'm not sure if it's the problem with python 2.7, since it works well with python 3.0
from ghpythonremote.
from ghpythonremote.
Hi @r-yu52, sorry it's been a while since you asked for help on this but I've been doing some cleaning around here and just looked at it again today.
From what I can tell, I can properly run sympy functionalities from Grasshopper, as long as all strings sent to it are bytes strings. (And of course, imports need to be properly defined in each of the GHPython scripts you run.) The code below gives the expected result:
import scriptcontext as sc
sp = sc.sticky['sympy']
x = sp.symbols(b'x')
q = sp.symbols(b'q', cls=sp.Function)
Mq = sp.symbols(b'Mq', cls=sp.Function)
Vq = sp.symbols(b'Vq', cls=sp.Function)
l = sp.symbols(b'l') # Symbol l was not defined
diffeqbmq = sp.Eq(Mq(x).diff(x, x), -q(x)) # -q is not valid, symbolic functions need to be instantiated: -q(x)
BMq = sp.dsolve(diffeqbmq, Mq(x), ics={Mq(0): 0, Mq(l): 0})
SFq = sp.Eq(Vq(x), BMq.rhs.diff(x))
print(BMq, SFq)
Note that your original code had a couple of additional errors that prevented it from working, even outside in regular CPython, see the comments in the code.
from ghpythonremote.
Related Issues (20)
- CPython_to_GH.py invoke Rhino 5.0 in a RH6 context HOT 1
- "No handlers could be found for handler "GH..."" in CPython to GH context
- Using Numba HOT 2
- importing methods from "ortools" library HOT 6
- Python 3+ support HOT 1
- Installation issue - Runtime error (ArgumentTypeException): expected buffer, got bytes HOT 1
- Propagate runtime messages through user object
- MacOS compatibility HOT 2
- ghPythonRemote for Python v3+ ? HOT 1
- GUIs (Matplotlib, OpenCV) segmentation fault on MacOS
- On MacOS, the GH panel does not print the ouput string in GH_to_CPython.ghx example
- Missing example files HOT 4
- Install gh-python-remote HOT 3
- On MacOS, `get_python_from_path` fails -- does not follow symlinks?
- Grasshopper crashes when adding time and datetime libraries HOT 1
- Runtime error (ImportException): No module named ghpythonremote HOT 6
- Problem running example files HOT 2
- some modules work failed -"Runtime error (SyntaxErrorException): invalid syntax" HOT 1
- "Location" is inside Docker container HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghpythonremote.