bsky
bsky

Reputation: 20222

ValueError: Attempted relative import beyond toplevel package

I have the following two files:

/quiz/quiz/views.py

and

/quiz/static/questions.html

I would like to import questions.html into views.py.

So I'm trying to do this:

from ..static import *

However, I'm getting:

ValueError: Attempted relative import beyond toplevel package

Upvotes: 0

Views: 798

Answers (1)

anati
anati

Reputation: 274

As Sebastian Wozny answered, you can not import such files in python.

Try to write module that parse useful data from html file then import that module.

Upvotes: 1

Related Questions