Git Product home page Git Product logo

confparse's People

Contributors

michaelcombs28 avatar

Watchers

 avatar

confparse's Issues

confparse.properties.read() doesn't handle single file

What steps will reproduce the problem?
1. See inline comments below.
2.
3.

What is the expected output? What do you see instead?
   Stack trace from _read()


What version of the product are you using? On what operating system?
Ubuntu, current version

Please provide any additional information below.
The code
    def read(self,filenames=[]):
        """read and parse the list of named configuration files, given
        by name.  A single filename is also allowed.  Non-existing
        files are ignored.  Return list of successfully read
        files. The filename attribute is update with the last element
        of the list, so that the write methods can be called with no
        argument"""

        if isinstance(filenames, basestring):
            self._read( file(filenames), filenames)
            self.template=filenames
            ###################################################
            # Single file processing falls through to following
            # for loop. Since filenames is a string, the forloop treats
            # each character as a filename.
            #
            # Should be an 'else' before the 'for'
            ###################################################

        for filename in filenames:
            try:
                fp = open(filename)
            except IOError:
                continue
            self._read(fp, filename)
            fp.close()

            self.template=filename

        return self.proxy




Original issue reported on code.google.com by [email protected] on 24 Mar 2009 at 3:39

confparse.properties() should take a tuple, only single filenames and lists are allowed

Summary says it all. Try:
  confparse.properties( [file1, file2] )
and is ok.
Try:
  confparse.properties( (file1, file2) )
and you get stack trace

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 24 Mar 2009 at 4:23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.