EXCLUSIVE

There was shooting in the middle of shooting "House of Lies," TMZ has learned.

Here's how it went down. This afternoon, the show was on location at Nickerson Gardens housing project in South Central L.A. Sources on the set tell us ... the location shoot attracted a crowd, which began to swell. Turns out, members of rival gangs were among the onlookers.

At one point, T.I., Don Cheadle and Kristen Bell had just finished a scene. The rival gang members began to get aggressive and suddenly shots rang out.

It's unclear how many members of the cast were still present when shots were fired, but we're told bodyguards jumped in to protect the cast and crew.

We're told no one was injured.

Cops were called but by then the gang members had dispersed.