ok-client icon indicating copy to clipboard operation
ok-client copied to clipboard

Cross-platform incompatibility

Open dericktseng opened this issue 5 years ago • 8 comments

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

dericktseng avatar Oct 01 '19 19:10 dericktseng

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

mehrdadn avatar Oct 02 '19 08:10 mehrdadn

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.

dericktseng avatar Oct 02 '19 17:10 dericktseng

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...

mehrdadn avatar Oct 02 '19 18:10 mehrdadn

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

dericktseng avatar Oct 02 '19 19:10 dericktseng

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

mehrdadn avatar Oct 02 '19 19:10 mehrdadn

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?

dericktseng avatar Oct 09 '19 03:10 dericktseng

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

evelynluw avatar Oct 10 '19 04:10 evelynluw

@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.

mehrdadn avatar Oct 10 '19 04:10 mehrdadn