Skip to content

Conversation

@saurabhshri
Copy link
Member

@saurabhshri saurabhshri commented Dec 13, 2016

Removes ambiguity as of why unable to open clean file. Gives better aid in resolving the issue.

Example : I have attached a console log below of 4 different runs. fopenerror.txt

  1. cf -output.txt

shouldn't work because I am working in directory which requires admin rights to create new files. Only displays : ###MESSAGE#Unable to open clean file: output.txt

  1. -cf /out/output.txt

same as above.

  1. -cf d:/out/output.txt

Directory d:/ doesn't require any admin right, but "out" doesn't exist. So again, only displays : ###MESSAGE#Unable to open clean file: output.txt

  1. -cf d:/output.txt

Works, because d:/ is both writable and exists.

@cfsmp3
Copy link
Contributor

cfsmp3 commented Dec 13, 2016

This is a good idea, but instead of using perror() use print_error() -as in the line above-. You can get the text from sterror (). Problem with perror() is that it always uses stderr which may be closed, or the user may have requested -quiet mode, etc.

@cfsmp3 cfsmp3 closed this Dec 13, 2016
@saurabhshri
Copy link
Member Author

@cfsmp3 Thank you! :)

I used perror() because when fopen returns with an error, it sets the variable errno with some number which contains the exact message (like permission denies etc.). But I see the problem.

print_error(CCX_COMMON_EXIT_FILE_CREATION_FAILED, "Unable to open clean file: %s\n", cfg->out_elementarystream_filename);
perror("Details : ");

Shall I replace it with :

print_error(CCX_COMMON_EXIT_FILE_CREATION_FAILED, "Unable to open clean file: %s \n. Details : %s \n", cfg->out_elementarystream_filename,strerror(errno));

@cfsmp3
Copy link
Contributor

cfsmp3 commented Dec 14, 2016 via email

@saurabhshri
Copy link
Member Author

saurabhshri commented Dec 14, 2016

@cfsmp3 I tried and it worked. :)

deatils

Now, I have formatted the output to remove that 'space' and '.' before 'Deatils'

It will now appear as :

saurabh@ubuntu:~/Desktop/cc/ccextractor-patch-7/linux$ ./ccextractor test.ts -autoprogram  -out=srt -bom -cf /out/output.txt -latin1
###MESSAGE#Unable to open clean file: /out/output.txt
Details : No such file or directory.

If it looks good to you, shall I send a PR?

EDIT:

Not using two print_error lines because if we supply mode (CCX_COMMON_EXIT_FILE_CREATION_FAILED), it displays :

###MESSAGE#Unable to open clean file: /out/output.txt

###MESSAGE#Details : No such file or directory .

and if we don't, i.e. mode (0), it displays :

###MESSAGE#Unable to open clean file: /out/output.txt

Error : Details : No such file or directory .

I think the 'single line' implementation produces cleaner result and also, the function is only called once. :)

@saurabhshri
Copy link
Member Author

@cfsmp3 Thanks :)

hrideshmg pushed a commit to hrideshmg/ccextractor that referenced this pull request Mar 12, 2025
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 1.4.5 to 1.4.7.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/master/CHANGES)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants