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.
import pandas as pd
import os
import time
from datetime import datetime
path = "/Users/tommasomasaracchio/Documents/pythonfolder"
def key_stats(gather="Total Deb/Equity (mrg)"):
statspath = path + '/KeyStats'
stock_list = [x[0] for x in os.walk(statspath)]
print(stock_list)
key_stats()
I thought the problem was gather but it seems not to be the case.
the terminal tells me this, and I don't really understand it
tommaso desktop % python programma.py
hello world
Traceback (most recent call last):
File "/Users/tommasomasaracchio/Desktop/programma.py", line 2, in <module>
import pandas as pd
File "/Users/tommasomasaracchio/opt/anaconda3/lib/python3.9/site-packages/pandas/__init__.py", line 179, in <module>
import pandas.testing
File "/Users/tommasomasaracchio/opt/anaconda3/lib/python3.9/site-packages/pandas/testing.py", line 6, in <module>
from pandas._testing import (
File "/Users/tommasomasaracchio/opt/anaconda3/lib/python3.9/site-packages/pandas/_testing/__init__.py", line 58, in <module>
from pandas._testing._io import ( # noqa:F401
File "/Users/tommasomasaracchio/opt/anaconda3/lib/python3.9/site-packages/pandas/_testing/_io.py", line 22, in <module>
from pandas._testing._random import rands
File "/Users/tommasomasaracchio/opt/anaconda3/lib/python3.9/site-packages/pandas/_testing/_random.py", line 10, in <module>
RANDS_CHARS = np.array(list(string.ascii_letters + string.digits), dtype=(np.str_, 1))
AttributeError: module 'string' has no attribute 'ascii_letters'
it show such as turtle.Terminator
AttributeError: module 'turtle' has no attribute 'forward'
>>> import turtle
>>> for i in range(50,100,10):
... for j in range(4):
... turtle.forward(i)
... turtle.left(90)
...
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "<string>", line 5, in forward
turtle.Terminator
Note: my excepted result is 4 square
I have been making a programme about a tic-tac-toe game which requires two players take turn to input like the coordinate of the board, like (r1,c1)->(r2,c2)->(r3,c3)-> …, in which r is the row and c is the column and the board look like
0 1 2
3 4 5
6 7 8
The programme I typed:
board=[0,1,2,3,4,5,6,7,8]
def show():
print(str(board[0])+str(board[1])+str(board[2]))
print(str(board[3])+str(board[4])+str(board[5]))
print(str(board[6])+str(board[7])+str(board[8]))
def check(char,spot1,spot2,spot3):
if board[spot1]==char and board[spot2]==char and board[spot3]==char:
return True
def checkAll(char):
if check(char,0,1,2):
return True
if check(char,3,4,5):
return True
if check(char,6,7,8):
return True
if check(char,0,3,6):
return True
if check(char,1,4,7):
return True
if check(char,2,5,8):
return True
if check(char,0,4,8):
return True
if check(char,2,4,6):
return True
else:
return False
def ChangeSpotInputToAList(spotInput):
spotafter=[]
for i in spotInput:
if i=="(0,0)":
spotafter.append(0)
if i=="(0,1)":
spotafter.append(1)
if i=="(0,2)":
spotafter.append(2)
if i=="(1,0)":
spotafter.append(3)
if i=="(1,1)":
spotafter.append(4)
if i=="(1,2)":
spotafter.append(5)
if i=="(2,0)":
spotafter.append(6)
if i=="(2,1)":
spotafter.append(7)
if i=="(2,2)":
spotafter.append(8)
return spotafter
i=0
spotInput=input().split("->")
spotafter=ChangeSpotInputToAList(spotInput)
for x in spotafter:
show()
if spotafter[x]%2==0:
print("X-->",x)
spot=x
i+=1
char="X"
board[spot]=char
if i==9:
show()
print("Winner: None")
break
if checkAll(char):
show()
print("Winner:",char)
break
if spotafter[x]%2==1:
print("O-->",x)
spot=x
i+=1
char="O"
board[spot]=char
if i==9:
show()
print("Winner: None")
break
if checkAll(char):
show()
print("Winner:",char)
break
I have tried some input but one of them keeps making an error, which is (2,2)->(0,0)->(1,1)->(0,2)->(1,0)->(0,1), and the programme shows:
012
345
678
Traceback (most recent call last):
File "thisishardlol.py", line 55, in <module>
if spotafter[x]%2==0:
IndexError: list index out of range
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "thisishardlol.py", line 55, in <module>
if spotafter[x]%2==0:
IndexError: list index out of range
Does anyone know where am I wrong? Any help would be very greatly appreciated!
Let's run through a scenario.
spotInput=input().split("->")
spotafter=ChangeSpotInputToAList(spotInput)
If I input (2,2)->(2,2) then spotafter = [8,8]
Now I enter my for loop:
for x in spotafter:
show()
if spotafter[x]%2==0:
In my first loop x = 8 and im trying to get spotafter[8], which doesnt exist (spotafter only has 2 elements).
I cant help much more since I dont know your goal, but thats why you're getting the IndexError.
I am trying to execute the following code that creates a cube in mesh:
import pygmsh as pg
import numpy as np
def generate():
geom = pg.Geometry()
geom.add_box(0, 1, 0, 1, 0, 1, 0.05)
return geom
if __name__ == '__main__':
import meshio
points, cells = pg.generate_mesh(generate())
meshio.write('cube.vtu', points, cells)
I'm getting the following error:
Traceback (most recent call last):
File "C:/Users/200498/PycharmProjects/untitled/pygmsh.py", line 17, in
<module>
points, cells = pg.generate_mesh(generate())
AttributeError: module 'pygmsh' has no attribute 'generate_mesh'
How can I fix that?
You've called your own script "pygmsh", so it's hiding the library you installed. Rename your file to something else.