ansys / pydyna

Python interface to the LS-DYNA solver
https://dyna.docs.pyansys.com
MIT License
38 stars 9 forks source link

Not Able to Open pydyna #319

Open pavankumarkonchada opened 1 year ago

pavankumarkonchada commented 1 year ago

import os import sys

from ansys.dyna.core.pre.dynasolution import DynaSolution from ansys.dyna.core.pre.dynamech import ( DynaMech, Airbag, PartSet, Curve, Point, RigidwallPlanar, Contact, ContactSurface, ContactCategory, ShellPart, ShellFormulation, )

from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric from ansys.dyna.core.pre import examples

hostname = "localhost" if len(sys.argv) > 1: hostname = sys.argv[1]

airbag_solution = DynaSolution(hostname) fns = []

path = sys.path[0] + os.sep + "input" + os.sep + "airbag_deploy" + os.sep

path = examples.airbag_deploy + os.sep fns.append(path + "airbag_deploy.k") airbag_solution.open_files(fns) I am getting the below error


OSError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_8076\3981983882.py in ----> 1 airbag_solution = DynaSolution(hostname) 2 fns = [] 3 # path = sys.path[0] + os.sep + "input" + os.sep + "airbag_deploy" + os.sep 4 path = examples.airbag_deploy + os.sep 5 fns.append(path + "airbag_deploy.k")

~\AppData\Roaming\Python\Python39\site-packages\ansys\dyna\core\pre\dynasolution.py in init(self, hostname, port) 57 def init(self, hostname="localhost", port="50051"): 58 # launch server ---> 59 check_valid_ip(hostname) # double check 60 if port is None: 61 port = int(os.environ.get("PYDYNAPRE_PORT", DYNAPRE_DEFAULT_PORT))

~\AppData\Roaming\Python\Python39\site-packages\ansys\dyna\core\pre\misc.py in check_valid_ip(ip) 180 if ip.lower() != "localhost": 181 ip = ip.replace('"', "").replace("'", "") --> 182 socket.inet_aton(ip) 183 184

OSError: illegal IP address string passed to inet_aton

When I check with sys.argv[1] it is giving me -f as the value please help

zhangzhanqun commented 11 months ago

Hi pavankumarkonchada, which platform are you using to run this example python file? vscode, jupyter notebook or other platform?