Skip to content

Solved TypeError Issue#1345

Merged
liiight merged 2 commits intoFlexget:developfrom
cryptelli:develop
Aug 17, 2016
Merged

Solved TypeError Issue#1345
liiight merged 2 commits intoFlexget:developfrom
cryptelli:develop

Conversation

@cryptelli
Copy link
Copy Markdown

Motivation for changes:

When the default fields on a web form aren't username or password the resulting HTML file the plugin tries to write generates the following error.

TypeError: must be unicode, not str

Detailed changes:

  • Added b to the open() function to enable the file to be written in binary.

Addressed issues:

Discovered by writing the formlogin.html file in binary mode no TypeError is generated. Also tested that if the fields were named their default username and password this problem doesn't occur it is only when it fails and creates the html file.
os.mkdir(received)
filename = os.path.join(received, '%s.formlogin.html' % task.name)
with open(filename, 'w') as f:
with open(filename, 'wb') as f:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well change it to use io.open instead imo.

@cryptelli
Copy link
Copy Markdown
Author

As per your suggestion @cvium it has now been updated to use io.open.

@liiight liiight merged commit 7d2cddc into Flexget:develop Aug 17, 2016
@liiight
Copy link
Copy Markdown
Member

liiight commented Aug 17, 2016

Thanks for this!

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

Successfully merging this pull request may close these issues.

3 participants