jbaiter / zotero-cli

Command-line interface for Zotero
MIT License
274 stars 41 forks source link

ImportError: No modle named #7

Closed hongyuanjia closed 8 years ago

hongyuanjia commented 8 years ago

Thanks for this great plugin. I went into an issue after I installed zotero-cli on my Windows 10 machine with python 3.5.2.

When I opened the cmd and run command zotcli configure, it returned error messages below:

C:\Users\jiaho\Documents>zotcli configure
Traceback (most recent call last):
  File "C:\Python35\Scripts\zotcli-script.py", line 9, in <module>
    load_entry_point('zotero-cli==0.2.1', 'console_scripts', 'zotcli')()
  File "c:\python35\lib\site-packages\pkg_resources\__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\python35\lib\site-packages\pkg_resources\__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "c:\python35\lib\site-packages\pkg_resources\__init__.py", line 2229, in load
    return self.resolve()
  File "c:\python35\lib\site-packages\pkg_resources\__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\python35\lib\site-packages\zotero_cli\main.py", line 8, in <module>
    import ConfigParser
ImportError: No module named 'ConfigParser'

Any insights to solve this problem? Thanks!

DancingQuanta commented 8 years ago

Hi You need to install a python module called ConfigParser, try the command

pip install ConfigParser

In the future if you see more of No module named 'module' error, try to install that module with pip.

hongyuanjia commented 8 years ago

@DancingQuanta Thank you for telling me that. I have no knowledge about python...

I have both python 2.7.12 and python 3.5.2 installed to avoid some compatibility issues. In my path, the path of python 3.5.2 is on the above of python 2.7.12, so when zotero-cli was installed in python 3.5.2 before. And after read this, I successfully installed ConfigParser, but still get the same error messages when running zotcli configure command.

But after I installed zotero-cli in python 2.7.12, ConfigParser error went away and it seems like zotero-cli was successfully installed. But the command zotcli configure did not work neither, giving other error messages below:

C:\Users\jiaho>zotcli configure
Usage: zotcli-script.py [OPTIONS] COMMAND [ARGS]...

Error: No such command "configure".
DancingQuanta commented 8 years ago

Apparently I do get the No such command "configure" error too. What operating system are you using?

DancingQuanta commented 8 years ago

Actually I think the information about zotcli configure is incorrect since I have just read the source code and I couldn't find any code responding to that command. Perhaps the documentation is out of the date or configure is a feature not yet implemented

hongyuanjia commented 8 years ago

@DancingQuanta I think you are absolutely right! There may be just no such command. I am using Windows 10 Build 1511. I think the documentation is out of date. The right way is to open the config.ini file located at C:\Users\#YOURNAME#\AppData\Roaming\zotcli\ and uncomment lines of api_key, library_id, and library_type and fill them with the right information. After that, command zotcli query works!

It may be helpful for others who have the same issue on setting zotero-cli up if @jbaiter could updates and adds the above notice to the documentation.

jbaiter commented 8 years ago

There is definitely such a command, the code for it is here: https://github.com/jbaiter/zotero-cli/blob/master/zotero_cli/cli.py#L70 The root cause of your issue is that you are trying to run the application with Python 3.5, while the code is currently targeting Python 2.7. I will try to make it forward-compatible, but for now please use Python 2.7 to configure it :-)