Changes to xbmcvfs.exists?
#1
Have there been any changes to VFSExists for Gotham...? I have some simple code and it's working on Alpha6 on my Windows boxes but a user in linux is reporting an issue. Code is really simply, and there are slashes at the end of the paths as I believe is required.

Basically it is this:
Code:
#strings to store the paths we will use
        RADAR_BACKGROUNDS_PATH = xbmc.translatePath("special://profile/addon_data/weather.ozweather/radarbackgrounds/" + radarCode + "/");
        LOOP_IMAGES_PATH = xbmc.translatePath("special://profile/addon_data/weather.ozweather/currentloop/" + radarCode + "/");

    #we need make the directories to store stuff if they don't exist
    if not xbmcvfs.exists( RADAR_BACKGROUNDS_PATH ):
        os.makedirs( RADAR_BACKGROUNDS_PATH )
    if not xbmcvfs.exists( LOOP_IMAGES_PATH ):
        os.makedirs( LOOP_IMAGES_PATH )

Gives an error:

Code:
20:59:58 T:139959354103552 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.OSError'>
Error Contents: (17, 'File exists', '/home/xbmc/.xbmc/userdata/addon_data/weather.ozweather/currentloop/IDR021/')
Traceback (most recent call last):
File "/home/xbmc/.xbmc/addons/weather.ozweather/default.py", line 578, in <module>
forecast(location, radar)
File "/home/xbmc/.xbmc/addons/weather.ozweather/default.py", line 167, in forecast
buildImages(radarCode)
File "/home/xbmc/.xbmc/addons/weather.ozweather/default.py", line 289, in buildImages
os.makedirs( LOOP_IMAGES_PATH )
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: (17, 'File exists', '/home/xbmc/.xbmc/userdata/addon_data/weather.ozweather/currentloop/IDR021/')

...but has een working for years fine on all platforms before this. .exists() is returning false but then the file exists, so it raises en exception. Obiviously I can try in a try/except but I think there might e a bug here?

Anyone else having any issues with Gotham Alpha 6??
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#2
I am pretty sure there are bugs in xbmcvfs.exists

...if I use it, it fails on directories that do exist, but if I substitute os.path.exists, the code works as expected.

If anyone is interested I can give more details but for now I am moving to os.path.exists as it's more reliable.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#3
The big (and only?) advantage of using "xbmcvfs" in favor of "os" is the possibility of using xbmc special filesystem-paths (plugin://, smb://, ...). I guess this is something you don't need so no need for xbmcvfs in that case.

Anyway, creating a ticket on track would be fine.
My GitHub. My Add-ons:
Image
Reply
#4
(2014-01-17, 19:56)sphere Wrote: The big (and only?) advantage of using "xbmcvfs" in favor of "os" is the possibility of using xbmc special filesystem-paths (plugin://, smb://, ...). I guess this is something you don't need so no need for xbmcvfs in that case.

Anyway, creating a ticket on track would be fine.

And smb:// support amongst things that os doesn't support
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
OK will trak it soon. This is just a straight windows path constructed above it using translatepath()
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
#6
ATV can't Mount network locations so xbmcvfs is the only way to accomplish writing to network locations on that platform
Reply
#7
(2014-01-16, 03:59)bossanova808 Wrote: If anyone is interested I can give more details but for now I am moving to os.path.exists as it's more reliable.

more details please. as usual, a full Debug Log wouldn't hurt. :-)

i've tested the code in your first post and it runs fine on linux.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#8
hmmm I think it's a known issues with shuti.rmtree returning before it has actually deleted a directory, and then my code trying to make it again...apparenyly a known thing due to async rmtree.

I'll look into it further but it's more like a general python thing I think
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply

Logout Mark Read Team Forum Stats Members Help
Changes to xbmcvfs.exists?0