dfd-tud / deda

https://dfd.inf.tu-dresden.de
GNU General Public License v3.0
1.57k stars 92 forks source link

ImportError: cannot import name 'main' #10

Closed frankmuc closed 6 years ago

frankmuc commented 6 years ago

I installed DeDa on different platforms but wherever I am running a command, it returns an error:

ImportError: cannot import name 'main'

Command (example):

deda_clean_document test.tif

deda was installed via pip3 install deda and all components were downloaded and installed. Everything was successful, but I just can't run any of the commands.

Last attempt was OpenSuSE an pip 10.0.1.

frankmuc commented 6 years ago

(base) C:\Users\Frank_PC>deda_clean_document test.png Traceback (most recent call last): File "d:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "d:\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda3\Scripts\deda_clean_document.exe__main__.py", line 5, in ImportError: cannot import name 'main'

jmgurney commented 6 years ago

Able to reproduce as well. Temporary work around is:

$python -m bin.deda_parse_print
usage: deda_parse_print.py [-h] [-m MASK] [-d DPI] [-o] [-v] file
deda_parse_print.py: error: the following arguments are required: file

Looks like the Main symbol in deda_parse_print changed to Main and a slightly different calling convention.

timojuez commented 6 years ago

Thank you. Fixed in version 1.0b3. $ pip3 install --upgrade deda

frankmuc commented 6 years ago

On Windows using Anaconda, I still have the same problem regarding "cannot import main". But the workaround "python -m bin.deda_parse_print" appears to work. Linux has not been tested yet because I need to start my ESXi.

timojuez commented 6 years ago

Please uninstall the old version. $ pip uninstall deda And check if deda_parse_print cannot be found. Are you on Deda version 1.0b3 when you reinstall?

frankmuc commented 6 years ago

I uninstalled and reinstalled (but it was already 1.0b3). Now I can no longer run deda_parse_print from the command line which worked previously:

deda_parse_print Command not found

but this works:

python -m bin.deda_parse_print

usage: deda_parse_print.py [-h] [-m MASK] [-d DPI] [-o] [-v] file deda_parse_print.py: error: the following arguments are required: file

The files in the Anaconda3\Scripts folder are now python text files without a file extension. Weren't these .exe files previously?

timojuez commented 6 years ago

Hi Frank,

the mentioned error is platform dependent unfortunately. But this has been fixed in the development branch and will work in the next release. Unix-style systems shall now be able to run the program. The Angloamerican OS indeed needs file extensions. Maybe for now add "python" to the call like $ python deda_parse_print #or $ python Anaconda3\Scripts\deda_parse_print

Best wishes to München