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

How do I "run" my python dictionary to get it to output a json? #4

Open
winstond opened this issue Sep 26, 2023 · 4 comments
Open

How do I "run" my python dictionary to get it to output a json? #4

winstond opened this issue Sep 26, 2023 · 4 comments

Comments

@winstond
Copy link

I tried:
python dictionary.py

But I get an error: ModuleNotFoundError: No module named 'plover'. I tried a few things, but I'm not super familiar with python so not sure what I'm missing.

Thank you.

@winstond winstond changed the title How to I "run" my python dictionary to get it to output a json? How do I "run" my python dictionary to get it to output a json? Sep 26, 2023
@user202729
Copy link
Owner

Not sure what I can support about this. I think you have a few options

  • hard code the system instead of importing from Plover
  • run it with a Python executable with access to Plover (depends on the operating system the instruction might be different... are you on Windows/Linux/Mac?)

@winstond
Copy link
Author

Yes, I do apologize. More of a Python question really. I'm on Win 11. Plover is in the usual place, C:\Program Files\Open Steno Project\Plover.

Perhaps once I can confirm the way to do this it could be added to the readme page?

I have a dictionary for Hindi I'd like to share, but right now I'd have to provide command line instructions for people to use it. Hoping to just have a JSON.

@winstond
Copy link
Author

Update: I managed to get it to work. Here are the steps in case anyone else stumbles on this:

Windows 11. Python install on system, but Plover uses it's own...

  1. Open a powershell (might need to open as admin depending on where your files are)
  2. Navigate to your plover directory (ex: c:\program files\open steno project\plover)
  3. Install plover-python-dictionary-lib in this instance of python with:
    .\data\python.exe -m pip install plover_python_dictionary_lib
  4. Run your python dictionary (which should include the line to print the dictionary to the terminal as per readme)
    .\data\python.exe .\hindirun.py
    Your dictionary should dump out to the terminal
  5. Highlight and copy your dictionary from the command prompt and make your json file.

(I tried piping to a file, but my JSON output had unicode characters so I got an encoding error. However copying the output in the terminal and pasting it still worked even though the terminal wouldn't display the the unicode characters properly.)

@user202729
Copy link
Owner

Some day it would be easier.

openstenoproject/plover_python_dictionary#9

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

No branches or pull requests

2 participants