Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-platform incompatibility #374

Open
dericktseng opened this issue Oct 1, 2019 · 8 comments
Open

Cross-platform incompatibility #374

dericktseng opened this issue Oct 1, 2019 · 8 comments

Comments

@dericktseng
Copy link

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
Copy link
Contributor

mehrdadn commented Oct 2, 2019

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

@dericktseng
Copy link
Author

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
Copy link
Contributor

mehrdadn commented Oct 2, 2019

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
Copy link
Author

dericktseng commented Oct 2, 2019

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
Copy link
Contributor

mehrdadn commented Oct 2, 2019

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
Copy link
Author

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
Copy link

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

@mehrdadn mehrdadn transferred this issue from okpy/ok Oct 10, 2019
@mehrdadn
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants