Lionel wrote:
On Feb 2, 1:07 pm, "Diez B. Roggisch" <de...@nospam.web.de> wrote:

This is written very slowly, so you can read it better:

Please post without sarcasm.


This is the output from my Python shell:

DatafilePath = "C:\\C8Example1.slc"
ResourcefilePath = DatafilePath + ".rsc"
DatafileFH = open(DatafilePath)
ResourceFh = open(ResourcefilePath)
DatafilePath
'C:\\C8Example1.slc'
ResourcefilePath
'C:\\C8Example1.slc.rsc'

Here the extension is '.rsc' ...

It seems to run without trouble. However, here is the offending code
in my class (followed by console output):

class C8DataType:

    def __init__(self, DataFilepath):

        try:
            DataFH = open(DataFilepath, "rb")

        except IOError, message:
            # Error opening file.
            print(message)
            return None

        ResourceFilepath = DataFilepath + ".src"

... but here the extension is '.src'.

Is that the problem.

        print(DataFilepath)
        print(ResourceFilepath)

        # Try to open resource file, catch exception:
        try:
            ResourceFH = open(ResourceFilepath)

        except IOError, message:
            # Error opening file.
            print(message)
            print("Error opening " + ResourceFilepath)
            DataFH.close()
            return None

Console output when invoking as "someObject = C8DataType("C:\
\C8Example1.slc")" :

C:\C8Example1.slc
C:\C8Example1.slc.src
[Errno 2] No such file or directory: 'C:\\C8Example1.slc.src'
Error opening C:\C8Example1.slc.src

[snip]
It can't find "C:\C8Example1.slc.src", but I think you intended "C:\C8Example1.slc.rsc".
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to