mcpi-e. error when getting coordinates. mc.player.getPos() - python

Code:
from mcpi_e.minecraft import Minecraft
mc = Minecraft.create('127.0.0.1', 4711)
pos = mc.player.getPos()
When trying to get coordinates.
mc.player.getPos()
an error pops up
Error:
Traceback (most recent call last):
File "C:\Users\merka\Desktop\pyt minecraft\buy.py", line 23, in <module>
pos = mc.player.getPos()
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\minecraft.py", line 230, in getPos
return CmdPositioner.getPos(self, self.playerId)
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\minecraft.py", line 50, in getPos
s = self.conn.sendReceive(self.pkg + b".getPos", id)
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\connection.py", line 103, in sendReceive
return self.receive()
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\connection.py", line 97, in receive
raise RequestError("%s failed"%self.lastSent.strip())
mcpi_e.connection.RequestError: b'entity.getPos()' failed
Process finished with exit code 1
what can be done?

mc = Minecraft.create('127.0.0.1', 4711, "merka")
I should have added a nickname

Related

KeyError: 0 in weighted deepWalk python

With running the weighted deppWalk implementation I faced with below error. I edit the source code based on issue1 and issu2 and issue3; but, problem still exist. How can I solve that? Is there any other library for weighted deepWalk in python?
Traceback (most recent call last):
File "/usr/local/bin/deepwalk", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/deepwalk/__main__.py", line 145, in main
process(args)
File "/usr/local/lib/python3.7/dist-packages/deepwalk/__main__.py", line 73, in process
walks = weighted_random_walk.random_walk(G, num_paths=args.number_walks,path_length=args.walk_length, alpha=0)
File "/usr/local/lib/python3.7/dist-packages/deepwalk/weighted_random_walk.py", line 45, in random_walk
sentence = [nodes[tmp] for tmp in indexList]
File "/usr/local/lib/python3.7/dist-packages/deepwalk/weighted_random_walk.py", line 45, in <listcomp>
sentence = [nodes[tmp] for tmp in indexList]
File "/usr/local/lib/python3.7/dist-packages/networkx/classes/reportviews.py", line 193, in __getitem__
return self._nodes[n]
KeyError: 0

AssertionError after trying to convert .sbml file to ode using sbmltoodepy

I am trying to run a simple example using sbmltoodepy and I am receiving the following error.
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\JetBrains\PyCharm2021.2\scratches\scratch_79.py", line 8, in
ParseAndCreateModel(inputFilePath)#, jsonFilePath=None, outputFilePath=None)#, className="SBMLmodel")
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\sbmltoodepy\utilities.py", line 66, in ParseAndCreateModel
modelData = ParseSBMLFile(inputFilePath)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\sbmltoodepy\parse.py", line 284, in ParseSBMLFile
assert(doc.getNumErrors() == 0)
AssertionError
Here is the code that I used.
import sbmltoodepy
from sbmltoodepy import ParseAndCreateModel
inputFilePath = "E:/Borisov2009_insulin_EGF.xml"
ParseAndCreateModel(inputFilePath, jsonFilePath=None, outputFilePath=None, className="SBMLmodel")
model = sbmltoodepy.SBMLmodel()
model.RunSimulation(1, absoluteTolerance = 1e-12, relativeTolerance = 1e-6)
Thank you in advance for your time.

rpy2 python-r mixed function

I was trying to run an R function through python's rpy2:
def gph(input1):
frac = rpackages.importr('fracdiff')
a = robjects.r(f'''
fdGPH({input1})
''')
print(a)
it returns an error however:
Traceback (most recent call last):
File "C:\Users\************\mainpage.py", line 168, in update_output
analiza_statystyczna.gph()
File "C:\Users\************\analiza_statystyczna.py", line 151, in gph
a = robjects.r(f'''
File "C:\Users\************\lib\site-packages\rpy2\robjects\__init__.py", line 450, in __call__
p = rinterface.parse(string)
File "C:\Users\************\lib\site-packages\rpy2\rinterface_lib\conversion.py", line 45, in _
cdata = function(*args, **kwargs)
File "C:\Users\************\lib\site-packages\rpy2\rinterface.py", line 108, in parse
res = _rinterface._parse(robj.__sexp__._cdata, num, rmemory)
File "C:\Users\************\lib\site-packages\rpy2\rinterface_lib\_rinterface_capi.py", line 652, in _parse
raise RParsingError('Parsing status not OK',
rpy2.rinterface_lib._rinterface_capi.RParsingError: Parsing status not OK - PARSING_STATUS.PARSE_ERROR
What am I doing wrong?

Error executing FMU model with pyFMI: "pyfmi.fmi.FMUException: Failed to get the Boolean values"

I am using the code below to simulate a model.
def run_demo(with_plots=True):
traj = np.array([[start_time,2.25]])
input_object = ('input_1[1]', traj)
model = load_fmu('[pyfmimodel.fmu',log_level=7)
opts = model.simulate_options ()
opts['ncp']=266
# Simulate
res = model.simulate(options=opts, input=input_object,final_time=stop_time )
This is the error I am getting. I need help to resolve this error.
Traceback (most recent call last):
File "D:\Projects\Python\DOCKER\model_2.py", line 55, in <module>
run_demo()
File "D:\Projects\Python\DOCKER\model_2.py", line 38, in run_demo
res = model.simulate(options=opts, input=input_object,final_time=stop_time )
File "src\pyfmi\fmi.pyx", line 7519, in pyfmi.fmi.FMUModelCS2.simulate
File "src\pyfmi\fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
File "src\pyfmi\fmi.pyx", line 372, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
File "C:\Users\tcto5k\Miniconda3\lib\site-packages\pyfmi\fmi_algorithm_drivers.py", line 984, in __init__
self.result_handler.simulation_start()
File "C:\Users\tcto5k\Miniconda3\lib\site-packages\pyfmi\common\io.py", line 2553, in simulation_start
[parameter_data, sorted_vars_real_vref, sorted_vars_int_vref, sorted_vars_bool_vref] = fmi_util.prepare_data_info(data_info, sorted_vars,
File "src\pyfmi\fmi_util.pyx", line 257, in pyfmi.fmi_util.prepare_data_info
File "src\pyfmi\fmi_util.pyx", line 337, in pyfmi.fmi_util.prepare_data_info
File "src\pyfmi\fmi.pyx", line 4377, in pyfmi.fmi.FMUModelBase2.get_boolean
pyfmi.fmi.FMUException: Failed to get the Boolean values.
This is the FMU model variable definition which accepts 1D array as input:
<ScalarVariable name="input_1[1]" valueReference="0" description="u" causality="input" variability="continuous">
<Real start="2.0"/>
</ScalarVariable>
<!-- 2 -->
<ScalarVariable name="dense_3[1]" valueReference="614" description="y (1st order)" causality="output" variability="continuous" initial="calculated">
<Real/>
</ScalarVariable>

How to fix raspberry pi 4 keyboard error?

In raspberry pi when I try to call keyboard module i get error like:
Traceback (most recent call last):
File "emergencyHorus.py", line 161, in <module>
detectKeyboard()
File "emergencyHorus.py", line 49, in detectKeyboard
if keyboard.is_pressed('d'):
File "/usr/local/lib/python3.7/dist-packages/keyboard/_init_.py", line 417, in is_pressed
steps = parse_hotkey(hotkey)
File "/usr/local/lib/python3.7/dist-packages/keyboard/_init_.py", line 344, in parse_hotkey
scan_codes = key_to_scan_codes(hotkey)
File "/usr/local/lib/python3.7/dist-packages/keyboard/_init_.py", line 317, in key_to_scan_codes
t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized)))
File "/usr/local/lib/python3.7/dist-packages/keyboard/_init_.py", line 317, in <genexpr>
t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized)))
File "/usr/local/lib/python3.7/dist-packages/keyboard/_nixkeyboard.py", line 153, in map_name
if len(parts) > 1 and parts[0] in ('left', 'right'):
KeyboardInterrupt
In my computuer code works great. Help please.

Categories