Feel free to drop me a line using: oleksii <you_know_that_symbol>

In case you are interested in professional partnership on a project or a venture check out my company website.


2 thoughts on “Contact”

  1. Hi, I have a lot of files that have non-ascii characters in the file names and I need those characters removed en batch instead of one at a time.

    I ran across your post entitled “Remove non-ascii characters in file names” from 3/17/2011. I built the exe file using python but when I run the exe in cmd I get the error message “NameError: name ‘new_file’ is not defined

    How do I fix this?

    Here is the script in the file:

    import os
    for file in os.listdir(u”.”):
    if os.path.isfile(file) and file.endswith(u’.rar’):
    new_file = “”.join(i for i in file if ord(i)<128)
    if (file != new_file):
    print u"Renaming", file.encode('utf8'),u" to ", new_file.encode('utf8')
    os.rename(file, new_file)

    1. Hi Stephen,

      thank you for your comment. Indeed, the error is correct as the new_file variable is defined only when the file_name is ending with the .rar extension. You can solve it in different ways, the easiest would be to add a line

      new_file = None

      just before the first ‘if’ statement. Alternatively you can put this in the ‘else’ statement for the first ‘if’.

      I hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.