okpy / ok-client

A Python client for the OK autograding system
https://okpy.org/
Apache License 2.0
57 stars 42 forks source link

Cross-platform incompatibility #374

Open dericktseng opened 5 years ago

dericktseng commented 5 years ago

If I run python3 ok -q [assignment] on one OS, and then tried to run it again via a different OS, I get the error dbm.error: db type could not be determined. Tested by initially running on Windows 10, then running it on linux

The entire error message is:

Checking for software updates...
OK is up to date
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "ok/__main__.py", line 46, in <module>
  File "ok/client/cli/ok.py", line 209, in main
  File "ok/client/protocols/grading.py", line 46, in run
  File "ok/client/protocols/grading.py", line 66, in grade
  File "ok/client/utils/storage.py", line 40, in store
  File "/usr/lib/python3.7/shelve.py", line 243, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/usr/lib/python3.7/shelve.py", line 227, in __init__
    Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
  File "/usr/lib/python3.7/dbm/__init__.py", line 88, in open
    raise error[0]("db type could not be determined")
dbm.error: db type could not be determined
mehrdadn commented 5 years ago

What does python3 -c "import sys; print(sys.version)" show on each platform?

dericktseng commented 5 years ago

On Manjaro Linux:

3.7.4 (default, Jul 16 2019, 07:12:58) 
[GCC 9.1.0]

On Windows:

3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)]

If I stay on the same OS (linux or windows), I can continue to use the OK autograder, but once I run it, I cannot use it for any other OS's except the one I started with.

mehrdadn commented 5 years ago

Hmm, interesting. I'm not getting an error, but in my case (64-bit Windows vs. Arch WSL) they don't recognize each others' logins, and so ask me to log in again, even after I've already logged in once into both. Still, that shouldn't be happening either...

dericktseng commented 5 years ago

If I use linux first to run OK, then try to run OK in windows, I get a slightly different error message:

Checking for software updates...
OK is up to date
Traceback (most recent call last):
  File "C:\...\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\...\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "ok\__main__.py", line 46, in <module>
  File "ok\client\cli\ok.py", line 209, in main
  File "ok\client\protocols\grading.py", line 46, in run
  File "ok\client\protocols\grading.py", line 66, in grade
  File "ok\client\utils\storage.py", line 40, in store
  File "C:\...\Python\Python37-32\lib\shelve.py", line 243, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "C:\...\Python\Python37-32\lib\shelve.py", line 227, in __init__
    Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
  File "C:\...\Python\Python37-32\lib\dbm\__init__.py", line 91, in open
    "available".format(result))
dbm.error: db type is dbm.gnu, but the module is not available
mehrdadn commented 5 years ago

Yeah, it seems to repro like this:

> wsl python3 -c "import dbm; dbm.open('Temp.dbm', 'c')[b'1'] = b'2'"

>     python3 -c "import dbm; dbm.open('Temp.dbm', 'c')[b'1'] = b'2'"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "...\lib\dbm\__init__.py", line 91, in open
    "available".format(result))
dbm.error: db type is dbm.gnu, but the module is not available
dericktseng commented 5 years ago

Is there going to be a fix for it, or do I need to file an issue on https://github.com/okpy/ok-client instead?

evelynluw commented 5 years ago

Same issue for me. A quick fix is to delete the pycache folder and all files starting with .ok to reinitialize ok grader

mehrdadn commented 5 years ago

@derickboss1 I don't know of a simple fix to this (though perhaps one of the main maintainers might). I would recommend you try to stay on a single platform for now, or find a workaround as mentioned here. Other tools (like git) often also run into trouble if you try to run them cross-platform, so it's a good habit anyway.