You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search the existing issues, especially the pinned issues.
Exception report
Oops, something went wrong. Please report this bug with the details below.Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new-----------------------------------------------------------------------Last 200 Keys: \ P y t h o n 3 7 \ p y t h o n . e x e ' Space ' c : \ U s e r s \ H P \ . v s c o d e \ e x t e n s i o n s \ m s - p y t h o n . p y t h o n - 2 0 2 2 . 4 . 1 \ p y t h o n F i l e s \ l i b \ p y t h o n \ d e b u g p y \ l a u n c h e r ' Space ' 6 1 5 2 3 ' Space ' - - ' Space ' c : \ U s e r s \ H P \ D e s k t o p \ P Y T H O N \ P y B a s i c s P r a c t i c a l \ W E B \ s c r a p e E X C 1 . p y ' Space EnterException:System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. Parameter name: topActual value was -1. at System.Console.SetCursorPosition(Int32 left, Int32 top) at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor) at Microsoft.PowerShell.PSConsoleReadLine.ForceRender() at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c) at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
#1. Write a script that grabs the full HTML from the page #2. Use the string .find() method to display the text following “Name:” and “Favorite Color:” (not including
any leading spaces or trailing HTML tags that might appear on the same line).
3. Repeat the previous exercise using regular expressions. The end of each pattern
should be a “<” (the start of an HTML tag) or a newline character, and you should remove
any extra spaces or newline characters from the resulting text using the string .strip() method.
Last 200 Keys:
\ P y t h o n 3 7 \ p y t h o n . e x e ' Space ' c : \ U s e r s \ H P \ . v s c o d e \ e x t e n s i o n s \ m s - p y t h o n . p y t h o n - 2 0 2 2 . 4 . 1 \ p y t h o n F i l e s \ l i b \ p y t h o n \ d e b u g p y \ l a u n c h e r ' Space ' 6 1 5 2 3 ' Space ' - - ' Space ' c : \ U s e r s \ H P \ D e s k t o p \ P Y T H O N \ P y B a s i c s P r a c t i c a l \ W E B \ s c r a p e E X C 1 . p y ' Space Enter
Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -1.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
The text was updated successfully, but these errors were encountered:
This issue was already fixed (see #1306). Please upgrade to the 2.2.3 version of PSReadLine from PowerShell Gallery.
See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.
Prerequisites
Exception report
Screenshot
N/A
Environment data
Steps to reproduce
#1. Write a script that grabs the full HTML from the page
#2. Use the string .find() method to display the text following “Name:” and “Favorite Color:” (not including
any leading spaces or trailing HTML tags that might appear on the same line).
3. Repeat the previous exercise using regular expressions. The end of each pattern
should be a “<” (the start of an HTML tag) or a newline character, and you should remove
any extra spaces or newline characters from the resulting text using the string .strip() method.
import re
from urllib.request import urlopen
url = "http://olympus.realpython.org/profiles/dionysus"
page = urlopen(url)
html = page.read().decode("utf-8")
print(html)
print("+++++")
start_heading = "
"
"end_heading = "
start_index = html.find(start_heading) + len(start_heading) + len("Name: ")
end_index = html.find(end_heading)
print(html[start_index:end_index])
print("+++++")
f_Color_start = "
"
f_Color_end = ""
start_index = html.find("Favorite Color") + len("Favorite Color: ")
end_index = html.find(f_Color_end)
print(html[start_index:end_index])
#Using re
pattern = "<h2.?>.?"
match_results = re.search(pattern,html,re.IGNORECASE)
name = match_results.group()
name = re.sub("<.*?>", "",name)
name = re.sub("Name: ","",name)
print(name)
pattern = "
\n.?"
match_result = re.search(pattern,html,re.IGNORECASE)
print(match_result)
#name = match_result.group()
name = re.sub("<.?>", "",name)
name = re.sub("Name: ","",name)
print(name)
Expected behavior
<TITLE >Profile: Dionysus</title / >Name: Dionysus
Hometown: Mount Olympus
Favorite animal: Leopard
Favorite Color: Wine
+++++
Dionysus
+++++
Wine
Name: Dionysus
None
Name: Dionysus
Actual behavior
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
Last 200 Keys:
\ P y t h o n 3 7 \ p y t h o n . e x e ' Space ' c : \ U s e r s \ H P \ . v s c o d e \ e x t e n s i o n s \ m s - p y t h o n . p y t h o n - 2 0 2 2 . 4 . 1 \ p y t h o n F i l e s \ l i b \ p y t h o n \ d e b u g p y \ l a u n c h e r ' Space ' 6 1 5 2 3 ' Space ' - - ' Space ' c : \ U s e r s \ H P \ D e s k t o p \ P Y T H O N \ P y B a s i c s P r a c t i c a l \ W E B \ s c r a p e E X C 1 . p y ' Space Enter
Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -1.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable
1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary
2 dispatchTable, Boolean ignoreIfNoAction, Object arg)at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
The text was updated successfully, but these errors were encountered: