简体   繁体   中英

Python - change module name, for more meaningful errors

Right now, I have custom classes I import like so:

import lib.directory as d

Then make an instance like:

directory = d.directory()

Then, in the process of using several of these classes in lib , I run into an error, say:

 File "./process.py", line 94, in <module>
   raise e
ValueError: Extra data: line 2 column 1 - line 3 column 1 (char 597 - 677)

How can I change the in <module> part to something more meaningful? Where does that value come from?

Cheers!

File "./process.py", line 94, in <module> means that line 94 in ./process.py was not inside a function. It was a module-level function call. If the error was in a function, the function name would appear instead of <module> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM