Re: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Ronaldo Bahia
thanks a lot: p = subprocess.Popen(('someprog.exe', str(i)) p.wait() *Ronaldo Bahia* +55 11 3280 6971 +55 11 963 622 581 *Materiais gratuitos para o RH:* - ROI - Melhorando Indicadores no RH

Re: Django Python OSError No such file or directory but file exists

2017-08-07 Thread François Schiettecatte
See: https://stackoverflow.com/questions/8953119/python-waiting-for-external-launched-process-finish François > On Aug 7, 2017, at 2:35 PM, Ronaldo Bahia wrote: > > How can I do that? > > Ronaldo Bahia > +55 11 3280 6971 > +55 11 963 622 581 > > Materiais

RE: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Matthew Pava
That’s a great idea. How do you do that programmatically? From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of "? ? (roboslone)" Sent: Monday, August 7, 2017 4:32 PM To: django-users@googlegroups.com Subject: Re: Django Python OSError No such

Re: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Ronaldo Bahia
Turns out unoconv takes 2 seconds to perform the file conversion. So after the file conversion, I had to set time.sleep(3) before upload a file to S3. And after 1 week I got this working using variables. Thanks *Ronaldo Bahia* +55 11 3280 6971 +55 11 963 622 581 *Materiais gratuitos para o

Re: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Ronaldo Bahia
I don't know why but if I set the string ("cv.pdf"), it process just fine. If I use a variable instead, it doesn't. Here is the working code: # convert to PDF env = os.environ.copy() env['HOME'] = '/tmp' subprocess.Popen(["unoconv","-f", "pdf", "-o", "cv.pdf","%s"

Re: Django Python OSError No such file or directory but file exists

2017-08-07 Thread Александр Христюхин (roboslone)
Well, yeah, you're using local path basically. And you should NEVER use .split('/')[-1] to determine file basename, take a look at os.path module instead. But that's not the point. You should try to use absolute path, I believe it would do the trick. > On 4 Aug 2017, at 17:49, Ronaldo Bahia

Re: Django Python OSError No such file or directory but file exists

2017-08-04 Thread Ronaldo Bahia
the method is called in a def post() within a class view: user_cv = CandidateCV.objects.get(user=request.user) user_cv_file = str(user_cv.resume).split('/')[-1] s3upload(user_cv_file) The file is converted from doc to pdf in server project folder, where manage.py is. So probably there is no

Re: Django Python OSError No such file or directory but file exists

2017-08-02 Thread Александр Христюхин (roboslone)
Hi, Are you sure s3file contains absolute path? I can't see where s3upload is being called. Also, you might wanna use os.remove instead of calling subprocess. You also might wanna check out PEP-8 and Sphinx for your docstrings. > On 2 Aug 2017, at 02:28, Ronaldo Bahia

Django Python OSError No such file or directory but file exists

2017-08-01 Thread Ronaldo Bahia
Hi everyone, can you help me? Thanks in advance Thread: https://stackoverflow.com/questions/45449102/django-python-oserror-no-such-file-or-directory-but-file-exists Code: down votefavorite