fleetingbytes / rtfparse

RTF Parser
MIT License
12 stars 8 forks source link

macOS error:NameError: name 'sys' is not defined #5

Closed hktalent closed 1 year ago

hktalent commented 1 year ago

1

conda create -n rtfparse -y python=3.9.16
conda activate rtfparse
conda init zsh
export PATH="$HOME/anaconda3/envs/rtfparse/bin:$PATH"
which pip python

pip install rtfparse

2

$ rtfparse

 ____ ____ __ _ ____ _ ____ _  _ ____ ____ ___ _ ____ __ _
 |___ [__] | \| |--- | |__, |__| |--< |--|  |  | [__] | \|
 _  _ _ ___  ____ ____ ___
 |/\| |  /__ |--| |--< |__>

◊ email_rtf (/Users/51pwn/rtfparse/email_rtf) does not exist!

(A) Automatically configure this and all remaining rtfparse settings
(C) Create this path automatically
(M) Manually input correct path to use or to create
(Q) Quit and edit `email_rtf` in rtfparse_configuration.ini

Uncaught exception NameError("name 'sys' is not defined") occurred.
Traceback (most recent call last):
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 83, in integrity_check
    assert path_to_check.exists()
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/entry.py", line 103, in cli_start
    with config_loader.Config(path_to_config, cli_args.autoconfig) as config:
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 57, in __init__
    self.integrity_check()
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 86, in integrity_check
    self.wizard(errors.WrongConfiguration(f"{self.path_to_config_file.name}: '{str(path_to_check)}', path does not exist!", preconf_path), autoconfig=self.autoconfig)
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 204, in wizard
    choice = wiz_menu.choose_from(options)
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/menu.py", line 81, in choose_from
    choice = self.wait_key()
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/menu.py", line 36, in wait_key
    fd = sys.stdin.fileno()
NameError: name 'sys' is not defined

3

$  rtfparse -f  /Users/51pwn/Documents/安全.scriv/Files/Docs/5872.rtf 

 ____ ____ __ _ ____ _ ____ _  _ ____ ____ ___ _ ____ __ _
 |___ [__] | \| |--- | |__, |__| |--< |--|  |  | [__] | \|
 _  _ _ ___  ____ ____ ___
 |/\| |  /__ |--| |--< |__>

◊ email_rtf (/Users/51pwn/rtfparse/email_rtf) does not exist!

(A) Automatically configure this and all remaining rtfparse settings
(C) Create this path automatically
(M) Manually input correct path to use or to create
(Q) Quit and edit `email_rtf` in rtfparse_configuration.ini

Uncaught exception NameError("name 'sys' is not defined") occurred.
Traceback (most recent call last):
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 83, in integrity_check
    assert path_to_check.exists()
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/entry.py", line 103, in cli_start
    with config_loader.Config(path_to_config, cli_args.autoconfig) as config:
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 57, in __init__
    self.integrity_check()
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 86, in integrity_check
    self.wizard(errors.WrongConfiguration(f"{self.path_to_config_file.name}: '{str(path_to_check)}', path does not exist!", preconf_path), autoconfig=self.autoconfig)
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/config_loader.py", line 204, in wizard
    choice = wiz_menu.choose_from(options)
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/menu.py", line 81, in choose_from
    choice = self.wait_key()
  File "/Users/51pwn/anaconda3/envs/rtfparse/lib/python3.9/site-packages/rtfparse/menu.py", line 36, in wait_key
    fd = sys.stdin.fileno()
NameError: name 'sys' is not defined
fleetingbytes commented 1 year ago

Thank you for the bug report. It looks like menu.py is missing import sys. I will try to fix it in the next days.

hktalent commented 1 year ago

thanks @fleetingbytes

fleetingbytes commented 1 year ago

reopening issue, still need to fix this.

fleetingbytes commented 1 year ago

@hktalent I have merged some changes in rtfparse 0.8.0. The CLI has changed. Try it.

hktalent commented 1 year ago

@fleetingbytes Thank you very much