Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script fails when executing by filetype associations on Windows #2

Closed
kay opened this issue Feb 1, 2010 · 3 comments
Closed

Script fails when executing by filetype associations on Windows #2

kay opened this issue Feb 1, 2010 · 3 comments

Comments

@kay
Copy link

kay commented Feb 1, 2010

Executing tvnamer on Microsoft Windows without explicitly executing a python interpretor causes the option parser to fail unexpectedly. Standard out result:

 dbr-tvdb_api-dad05f3>tvnamer.py "f:\some valid path"
 Usage: tvnamer.py [options] <file or directories>

 tvnamer.py: error: No filenames or directories supplied

This also happens for other options, such as --help or -h as a result. When explicitly executed in python tvnamer is successful.

 dbr-tvdb_api-dad05f3>python tvnamer.py --help
 Usage: tvnamer.py [options] <file or directories>

 Options:
   -h, --help         show this help message and exit
   -d, --debug        show debugging info
   -b, --batch        selects first search result, requires no human
                      intervention once launched
   -i, --interactive  interactivly select correct show from search results
                      [default]
   -s, --selectfirst  automatically select first series search result (instead
                      of showing the select-series interface)
   -r, --recursive    recursivly search supplied directories for files to
                      rename
   -a, --always       always renames files (but still lets user select correct
                      show). Can be changed during runtime with the 'a' prompt-
                      option
   -f, --force        forces file to be renamed, even if it will overwrite an
                      existing file
@dbr
Copy link
Owner

dbr commented Feb 1, 2010

Not sure what is happening.. Could you try with the latest version (from this repository)? tvnamer.py is from the old version and has stopped being developed.

What interpreter is this with? I'm not too sure how Windows deals with running python files directly (since it doesn't use the shbang), I assume it's with the associated executable?

Also does it work if you run tvnamer on a file (not directories), or with a relative path? Might be something to do with the F:\ bit (although the os.path module should handle this fine)

If this is still an issue with tvnamer v2 I'll boot into Windows and have a look..

@kay
Copy link
Author

kay commented Feb 1, 2010

Version:

ActivePython 2.6.3.7 (ActiveState Software Inc.) based on
Python 2.6.3 (r263:75183, Oct  5 2009, 14:41:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

When you run any Windows file something called ShellExecute is called. This looks up in the registry for the associated executable to a particular filetype. Then Windows executes that binary with the filename as the argument. It has an impact however on the value of argv[0] to use C-style terminology.

Using a file it fails.

dbr added a commit that referenced this issue Nov 14, 2011
dbr added a commit that referenced this issue Nov 14, 2011
@dbr
Copy link
Owner

dbr commented Sep 29, 2020

Closing old ticket. Installing via pip and running tvnamer [...] works correctly as per #188 which would be the supported means of running this on Windows

@dbr dbr closed this as completed Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants