Calling rapydml on a file located within a directory

26 views
Skip to first unread message

pmi...@mrcagney.com

unread,
Dec 7, 2014, 6:50:20 PM12/7/14
to rap...@googlegroups.com
Hi,

I have a process which watches for movement in a folder and calls rapydcss, rapydml etc on relevant files as they're updated. As a result, the 'location' that is passed to rapydcss/rapydml is something of the form 'my_directory/static/css/style.css' or 'my_directory/templates/template.pyml'. It seems that when when calling rapydml with a location like this, it doesn't compile correctly. The following error is also thrown:

Traceback (most recent call last):
  File "/usr/local/bin/rapydml", line 45, in <module>
    output.write(html.parse(args.input.name))
  File "/usr/local/lib/python2.7/dist-packages/rapydml_scripts/compiler.py", line 1082, in parse
    with open(filename, 'r') as source:
IOError: [Errno 2] No such file or directory: my_directory/template.pyml'

It works fine if I call rapydml from within my 'my_directory' on template.pyml and it is of note that rapydcss works fine in this regard.

Cheers,

Pete Mills

Alexander Tsepkov

unread,
Dec 8, 2014, 9:41:38 AM12/8/14
to pmi...@mrcagney.com, rap...@googlegroups.com
Problem stems from the way rapydml figures out its running location. There are multiple ways in Python for doing so, and all have their own drawbacks - the method I decided to go with uses the location of the triggering script, which is why you're seeing this issue. In the end, it seemed like I was stuck between location of currently running file and location of original Python file that triggered the execution. If you have a better alternative, feel free to submit it.
Reply all
Reply to author
Forward
0 new messages