Custom Query (132 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (16 - 18 of 132)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Ticket Resolution Summary Owner Reporter
#36 invalid PyYaml and WebWare Don't Play Nicely... xi stef@…

Reported by stef@…, 8 years ago.

Description

Hello,

Sorry to ask a stupid question, but, is PyYaml? thread-safe ? I am trying to run PyYaml? under WebWare? and I get a session identifier. Due to the nature of WebWare? being servlet based, I find that it sometimes calls 'get session' more than once during the lifetime of processing the servlet. The code that get's run more than once is;

    def __getitem__(self, key):
        if debug:
            print '>> get (%s)' % key
        filename = self.filenameForKey(key)
        self._lock.acquire()
        try:
            try:
                file = open(filename)
            except IOError:
                raise KeyError, key
            try:
                try:
                    item = yaml.load(file)
                finally:
                    file.close()
            except:                 # session can't be unpickled
                os.remove(filename) # remove session file
                print "Error loading session from disk:", key
                self.application().handleException()
                raise KeyError, key
        finally:
            self._lock.release()
        return item

When I put wrapper print statements around the yaml.load, I notice that the first time it works without fail, the next time I get this;

>> get (20061016171933-d0e40d4c65b62dffbbe4c3d2b21922a5)
 RIGHT BEFORE YAML.load for <open file '/usr/local/web_work/Sessions/20061016171933-d0e40d4c65b62dffbbe4c3d2b21922a5.ses', mode 'r' at 0xb71798d8> (/usr/local/web_work/Sessions/20061016171933-d0e40d4c65b62dffbbe4c3d2b21922a5.ses)
[Mon Oct 16 17:20:28 2006] [error] WebKit: Error while executing script /usr/local/web_work/Compass/RebookHotelPage.py
Traceback (most recent call last):
  File "/usr/local/webware-cvs/WebKit/Application.py", line 436, in dispatchRawRequest
    self.runTransaction(trans)
  File "/usr/local/webware-cvs/WebKit/Application.py", line 487, in runTransaction
    self.runTransactionViaServlet(servlet, trans)
  File "/usr/local/webware-cvs/WebKit/Application.py", line 512, in runTransactionViaServlet
    servlet.runTransaction(trans)
  File "WebKit/Servlet.py", line 41, in runTransaction
  File "/usr/local/webware-cvs/WebKit/Transaction.py", line 108, in awake
    self._servlet.awake(self)
  File "/usr/local/web_work/Compass/RebookHotelPage.py", line 74, in awake
    print " %s - %s " % ( self, self.session() )
  File "WebKit/Page.py", line 151, in session
  File "/usr/local/webware-cvs/WebKit/Transaction.py", line 69, in session
    self._session = self._application.createSessionForTransaction(self)
  File "/usr/local/webware-cvs/WebKit/Application.py", line 312, in createSessionForTransaction
    session = self.session(sessId)
  File "/usr/local/webware-cvs/WebKit/Application.py", line 279, in session
    return self._sessions[sessionId]
  File "/usr/local/webware-cvs/WebKit/SessionFileStore.py", line 59, in __getitem__
    myItem = yaml.load(file)
  File "build/bdist.linux-i686/egg/yaml/__init__.py", line 66, in load
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 38, in get_data
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 50, in construct_document
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 393, in construct_yaml_seq
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 120, in construct_sequence
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 96, in construct_object
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 572, in construct_python_object
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 551, in make_python_instance
TypeError: __new__() takes exactly 2 arguments (1 given)

So, from my total layman's perspective, it appears that the init.py is expected to be called 'once', yet due to WebWare?'s threading, I think it get's called more than once. Either way, I could be totally and whole heartedly wrong, any ideas ?

Priority is 'high' as I am on a strict timeline to understand what's going on, and severity is definitely 'blocker', as without a resolution, WebWare? can't use PyYaml?. Which, is kinda weird, but, at least in my experience :)

Regards and Thanks Stef

#62 fixed value token of single period ('.') is parsed incorrectly, throws wrong exception xi sproaticus

Reported by sproaticus, 7 years ago.

Description

A scalar value token consisting of just a period ('.') is interpreted as a float value. When construct_yaml_float() creates a float using this value, it throws an uncaught ValueError instead of yaml.YAMLError

(Also, what's PIL doing in the stack? I didn't import it.)

>>> yaml.load('yaml: .')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 66, in load
    
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 38, in get_data
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 46, in construct_document
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 394, in construct_yaml_map
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 207, in construct_mapping
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 132, in construct_mapping
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 87, in construct_object
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 281, in construct_yaml_float
ValueError: invalid literal for float(): .

Environment:

  • Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
  • PyYAML-3.05-py2.5.egg
#63 invalid % character cannot start a scalar value token xi sproaticus

Reported by sproaticus, 7 years ago.

Description

A scalar value cannot start with a % (percent sign) character, though the YAML specification only reserves that character at the beginning of a non-indented line for directives and tags (see  http://yaml.org/spec/current.html#id2523453 and  http://yaml.org/spec/current.html#id2524297 ). This character should be legal as the first character of a scalar value, e.g. for Python %s-style string substitution and templates.

>>> yaml.load('yaml: %')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 66, in load
    
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 38, in get_data
  File "build/bdist.linux-i686/egg/yaml/composer.py", line 27, in get_node
  File "build/bdist.linux-i686/egg/yaml/composer.py", line 34, in compose_document
  File "build/bdist.linux-i686/egg/yaml/composer.py", line 63, in compose_node
  File "build/bdist.linux-i686/egg/yaml/composer.py", line 112, in compose_mapping_node
  File "build/bdist.linux-i686/egg/yaml/composer.py", line 43, in compose_node
  File "build/bdist.linux-i686/egg/yaml/parser.py", line 95, in check_event
  File "build/bdist.linux-i686/egg/yaml/parser.py", line 446, in parse_block_mapping_value
  File "build/bdist.linux-i686/egg/yaml/scanner.py", line 116, in check_token
  File "build/bdist.linux-i686/egg/yaml/scanner.py", line 257, in fetch_more_tokens
yaml.scanner.ScannerError: while scanning for the next token
found character '%' that cannot start any token
  in "<string>", line 1, column 7:
    yaml: %
          ^

Environment:

  • Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
  • PyYAML-3.05-py2.5.egg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Note: See TracQuery for help on using queries.