Uploads the .pyc file to github Ha take that! Alright I’d feel to mean doing that so that would never happen.
ST3: ExportHtml
[quote=“castles_made_of_sand”]
Cool, I might take @faceless lead and sit this one out too [/quote]
Sit’n is where it’s at .
[quote=“facelessuser”]
[quote=“castles_made_of_sand”]
Cool, I might take @faceless lead and sit this one out too [/quote]
Sit’n is where it’s at .[/quote]
Here you go you sit’n…ers? If you come across any issues or can think of any improvements, let me know.
Looks good
Python 3 AFAIK seems to auto magically open(f).read() as unicode, defaulting to utf8
Defaulting to utf8 might not hurt, but having a possibility to consistently get bytes back might be nice …
I think zipfile.ZipFile.read, on the other hand, will always return bytes, even on python 3?
def get_package_asset(package_name, file_name, get_path=False):
I’d like to make a feature request ( bloody rich right??
I want another helper that will get some arbitrary path and determine the pakage_name/file_name from it so I can feed it to the get_package_asset guy
[code]>>> import Default.sort
Default.sort.file
‘/home/nick/sublime_text_3/Packages/Default.sublime-package/sort.py’
[/code]
[quote=“castles_made_of_sand”]def get_package_asset(package_name, file_name, get_path=False):
I’d like to make a feature request ( bloody rich right??
I want another helper that will get some arbitrary path and determine the pakage_name/file_name from it so I can feed it to the get_package_asset guy
[code]>>> import Default.sort
Default.sort.file
‘/home/nick/sublime_text_3/Packages/Default.sublime-package/sort.py’
[/code][/quote]
I’ll take a look at the things you mentioned. If you insist, I suppose I will be a helpful developer and add that
@skuroda thanks for doing this. When I get off my butt tomorrow I am going to try this. Sounds like @castles is trying to keep you busy . I like his suggestion though.
gist.github.com/skuroda/4965913 … set-py-L21
Also, you could probably cut to the chase there, just piecing together an absolute path, checking if the file exists, rather than doing two os.listdir() calls.
Let’s pretend that I did that originally I did it in the _search_zip method. Also added a method to get package and asset name from absolute path. Updates on the Gist .
Edit: err half way. Woops.
Another thing, generally you wanna use try/finally when using open() zipfile.ZipFile() etc
Python has with
for that: with open(bla) as file_handle: file_handle.read()
def get_package_and_asset(path):
package = os.path.basename(os.path.dirname(path))
package = package.replace(".sublime-package", "")
asset = os.path.basename(path)
return (package, asset)
I want my money back! Oh wait, I didn’t pay any nor do I really care about windows absolute paths!
[quote=“castles_made_of_sand”]def get_package_and_asset(path):
package = os.path.basename(os.path.dirname(path))
package = package.replace(".sublime-package", "")
asset = os.path.basename(path)
return (package, asset)
I want my money back! Oh wait, I didn’t pay any nor do I really care about windows absolute paths![/quote]
Looks at my poor poor windows machine that I am forced to use for development
Nevermind I’m satiated haha
os.path.basename
That’s the one I was trying to think of the other day
[code]>>> import posixpath
import ntpath
ntpath.basename(“C:\fuck\fucker”)
‘fucker’os.path is posixpath
True
[/code]
Learn something every day