simlist/pyluach

parshios.getparsha_string(): Parsha variable is referenced before assignment.

Closed this issue · 2 comments

Good morning,

I noticed an issue with the new update:

Steps to Reproduce:

  1. Install the latest version of the package.
  2. Load up a python console
    2.5. Import the library (from pyluach import dates, parshios, hebrewcal)
  3. Create a today variable (e.g. today = dates.HebrewDate.today() )
  4. Call the function e.g. parshios.getparsha_string(today)

Expected Behavior:

Returns a string of the parsha

Actual Behavior:

Throws the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/menachem/.local/lib/python3.5/site-packages/pyluach/parshios.py", line 137, in getparsha_string
    if parsha is None:
UnboundLocalError: local variable 'parsha' referenced before assignment

Proposed Solution:

Move line 139 above line 137 so that parsha is assigned before the check.

Notes

Already fixed in dev branch

Line location:

if parsha is None:

Thank you for pointing that out. I forgot to merge that fix.

Your welcome. Chag Sameach!