Error: Not enough values to unpack. Numerically solving a 1D coupled ODE

Hi there. I picked Fenics up a couple of days ago and am trying to simulate a pair of first order coupled, linear ODEs on the interval [0,\pi] for practice. My ODE’s are: u_1'=2u_2 and u_2'=-2u_1
with boundary conditions u_1(0)=u_1(\pi)=0 and u_2(0)=u_2(\pi)=1

My attempt to implement this results in 'ValueError: not enough values to unpack (expected 1, got 0). The error occurs on the line ‘A1=assemble(a1)’.Below is my code.

from fenics import *
# Create mesh and define function space
mesh = IntervalMesh(30,0,pi)
#we are solving for two unknowns u1, u2 each ui must be in its own funtion space
P1 = FiniteElement('P',interval, 1)
element = MixedElement([P1,P1])
V = FunctionSpace(mesh,element)

#need to create test function as a vector v1,v2
v = TestFunction(V)
v_1,v_2=split(v)

#this creates the function and then defines its components.
u = TrialFunction(V)
u_1,u_2=split(u)

#defines boundaries
top='near(x[0],pi)'
bottom='near(x[0],0)'

#sets bc at the boundaries
bc_top=DirichletBC(V,[Constant(0),Constant(1)],top)
bc_bottom=DirichletBC(V,[Constant(0),Constant(1)],bottom)

bc_list=[bc_top,bc_bottom]

#now define the variational problem

F=(u_1.dx(0)*v_1-2*u_2*v_1+u_2.dx(0)*v_2+2*u_1*v_2)*dx

a1=rhs(F)
L1=lhs(F)

A1=assemble(a1)
b1=assemble(L1)
[bc.apply(b1) for bc in bc_list]
solve(A1,u_.vector(),b1)

Any advice on what is going on would be very much appreciated! - Also fenics is a super amazing program thank you devs!

Hello,
so first your bilinear form should be a1=lhs(F) and not rhs. In fact here you do not need that since F is already a bilinear form. Therefore rhs returns nothing so you should define L using something like L = Constant(0)*v_1*dx.

How silly of me! You are right a1 should be defined as the lhs. Also thank you for pointing out that Fenics does not automatically declare rhs(F) of zero value in this case.
Thanks for your help!