Python Forum
script closed before i can see the error that occurs?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
script closed before i can see the error that occurs?
#7
Let's start by thinking about files in general.

This script you wrote, is a plain text file. You can open it in notepad, and it'll look the same.
An iso file is not plain text. It contains many characters that you can't pronounce (...or draw), in order to compress itself to something small, instead of restricting itself to just what makes sense when you look at it.

Python tries to be very helpful and friendly. When you tell it to open a file, it tries to parse that file so it's easy to work with in your script. The error you're getting is because iso files contain nonsense characters, which python can't understand. The way around that, is to give python hints about what it should expect to see when it starts looking in that file.

For your code, that means we're talking about line 15: "f = open(pathfile)". If you change that line to what snippsat suggested, so it looks like this: "f = open(pathfile, encoding="utf8")", and change nothing else about your script at all, do you still get an error?
Reply


Messages In This Thread
RE: Script help - by micseydel - Dec-01-2016, 05:30 PM
RE: Script help - by wrestlemy69 - Dec-01-2016, 05:38 PM
RE: Script help - by nilamo - Dec-01-2016, 06:03 PM
RE: Script help - by snippsat - Dec-01-2016, 06:21 PM
RE: script closed before i can see the error that occurs? - by nilamo - Dec-01-2016, 11:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [closed] check whether an integer is 32 or 64 bits paul18fr 4 281 May-27-2024, 04:55 PM
Last Post: deanhystad
  This result object does not return rows. It has been closed automatically dawid294 6 1,668 Mar-30-2024, 03:08 AM
Last Post: NolaCuriel
  OSError occurs in Linux. anna17 2 483 Mar-23-2024, 10:00 PM
Last Post: snippsat
  A question about 'Event loop is closed' fc5igm 2 2,402 Oct-05-2021, 02:00 AM
Last Post: fc5igm
  ValueError: I/O operation on closed file problem aliwien 0 2,193 Apr-23-2021, 05:50 PM
Last Post: aliwien
  Run an app in a standalone terminal and wait until it's closed glestwid 2 2,627 Aug-30-2020, 08:14 AM
Last Post: glestwid
  how do i loop a "def ..." when error occurs? Stan2292 0 1,684 Aug-12-2019, 05:28 AM
Last Post: Stan2292
  Inclusive (closed) range with float numbers mapg 4 4,164 Apr-27-2019, 09:09 PM
Last Post: Gribouillis
  New df from existing when condition occurs Devilish 0 1,427 Jan-10-2019, 12:03 AM
Last Post: Devilish
  VMware View - Session opened/closed? hhh 0 2,396 May-31-2018, 10:10 AM
Last Post: hhh

Forum Jump:

User Panel Messages

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