Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
argparse io issue
#8
(Apr-02-2024, 10:24 AM)pyDream Wrote: So this part not only defines how the script would read a dictionary, but also how it will write to the console, correct?
Just to be clear.
No,the error happens before all the reading and use of argparse.
The problem happens in setup.py where read function is reading files like,
README.rst or __init__.py that contain metadata or other information needed in the setup script.
This can be hard to understand if you have not deal with building a package in Python.

If you want try as a excerice,here is step how it did rebuild this so it work in eg Python 3.12
# Make Virtual enviroemnt 
G:\div_code
λ python -m venv lsdreader_env

G:\div_code
λ cd lsdreader_env\

G:\div_code\lsdreader_env
λ G:\div_code\lsdreader_env\Scripts\activate

# Install build tools
G:\div_code\lsdreader_env
(lsdreader_env) λ pip install setuptools wheel
.....
Installing collected packages: wheel, setuptools
Successfully installed setuptools-69.2.0 wheel-0.43.0

# Clone down Repo
G:\div_code\lsdreader_env
(lsdreader_env) λ git clone https://github.com/sv99/lsdreader.git
Cloning into 'lsdreader'...
remote: Enumerating objects: 153, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (16/16), done.
Receiving objects:  88% (135/153)
Receiving objects: 100% (153/153), 1.05 MiB | 3.56 MiB/s, done.
Resolving deltas: 100% (77/77), done.

G:\div_code\lsdreader_env
(lsdreader_env) λ cd lsdreader\

# Make the changes to <read> in setup.py
G:\div_code\lsdreader_env\lsdreader (master -> origin)
(lsdreader_env) λ ls
decoder.rar  LICENSE.md  lingvoreader/  README.rst  setup.py*  test/  testdata/

# Make the wheel
G:\div_code\lsdreader_env\lsdreader (master -> origin)
(lsdreader_env) λ python setup.py bdist_wheel
running bdist_wheel
running build
....

# Cd to dist folder
G:\div_code\lsdreader_env\lsdreader (master -> origin)
(lsdreader_env) λ cd dist

G:\div_code\lsdreader_env\lsdreader\dist (master -> origin)
(lsdreader_env) λ ls
lingvoreader-0.2.15-py3-none-any.whl

# Install wheel
G:\div_code\lsdreader_env\lsdreader\dist (master -> origin)
(lsdreader_env) λ pip install lingvoreader-0.2.15-py3-none-any.whl
Processing g:\div_code\lsdreader_env\lsdreader\dist\lingvoreader-0.2.15-py3-none-any.whl
Installing collected packages: lingvoreader
Successfully installed lingvoreader-0.2.15

# Test that it work
G:\div_code\lsdreader_env
(lsdreader_env) λ lsdreader --help
usage: lsdreader [-h] (-i INPUT | -a) [--header] [-o OUTDIR] [-c] [-v] [--version]

Decode Lingvo lsd dictionary to dsl

options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Dictionary to decode
  -a, --all             All dictionary in current directory
  --header              Print dictionary header and exit
  -o OUTDIR, --outdir OUTDIR
                        Output directory
  -c, --codecs          print supported languages and their codes
  -v, --verbose
  --version             show program's version number and exit
Reply


Messages In This Thread
argparse io issue - by pyDream - Mar-27-2024, 02:41 PM
RE: argparse io issue - by snippsat - Mar-27-2024, 06:04 PM
RE: argparse io issue - by pyDream - Mar-29-2024, 07:55 PM
RE: argparse io issue - by snippsat - Mar-29-2024, 10:06 PM
RE: argparse io issue - by pyDream - Apr-01-2024, 11:22 AM
RE: argparse io issue - by snippsat - Apr-01-2024, 12:03 PM
RE: argparse io issue - by pyDream - Apr-02-2024, 10:24 AM
RE: argparse io issue - by snippsat - Apr-02-2024, 12:01 PM
RE: argparse io issue - by pyDream - Apr-02-2024, 12:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Not able to figure out what is wrong with argparse radioactive9 31 9,004 Mar-16-2022, 07:50 PM
Last Post: deanhystad
  argparse --help in one line. Denial 1 2,040 Sep-20-2020, 03:38 PM
Last Post: deanhystad
  Argparse error when inputting values tqader 2 2,947 Sep-11-2020, 07:42 PM
Last Post: buran
  Why this pycharm warning for argparse formatter_class value? pjfarley3 2 2,177 Sep-09-2020, 05:23 AM
Last Post: pjfarley3
  Can argparse support undocumented options? pjfarley3 3 2,298 Aug-14-2020, 06:13 AM
Last Post: pjfarley3
  In ArgParse, can two compatible formatter_class values be used? pjfarley3 2 2,666 Jul-31-2020, 02:01 PM
Last Post: pjfarley3
  Why am I getting KeyError 'file' when using argparse? Mike Ru 1 3,124 Jun-09-2019, 04:48 PM
Last Post: metulburr
  How can I get some arguments using argparse? Mike Ru 0 1,910 Jun-05-2019, 12:57 PM
Last Post: Mike Ru
  argparse 2skywalkers 4 3,214 May-15-2019, 07:00 PM
Last Post: Gribouillis
  argparse and imported modules spatialdawn 2 5,520 Dec-01-2018, 12:35 PM
Last Post: spatialdawn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020