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

Leading slashes in temp file paths for "rerun" #19

Open
GoogleCodeExporter opened this issue Mar 24, 2016 · 1 comment
Open

Leading slashes in temp file paths for "rerun" #19

GoogleCodeExporter opened this issue Mar 24, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

pyp v2.12 (svn rev 238) cannot be run at all on Windows (native Python, not a 
cygwin port) because the temporary files  '/%s/pyp_rerun_%d.txt' for "rerun" 
functionality of pyp are created with an unnecessary leading forward slash in 
the file path. 

I think there is no reason to use '/%s/pyp_rerun_%d.txt' instead of 
'%s/pyp_rerun_%d.txt'.

Python's tempfile.gettempdir() always returns an absolute path from the root of 
the filesystem on all platforms (see Python module source at 
http://hg.python.org/cpython/file/tip/Lib/tempfile.py#l130 ). 

Patch is attached. I have tested that everything works on Linux, and everything 
except "rerun" works on Windows (will post the complete fix for rerun on 
Windows later).


Index: pyp
===================================================================
--- pyp (revision 238)
+++ pyp (working copy)
@@ -1397,12 +1397,12 @@
             print Docs.unmodified_config
             sys.exit()

-        rerun_path = '/%s/pyp_rerun_%d.txt' 
%(tempfile.gettempdir(),os.getppid())        
+        rerun_path = '%s/pyp_rerun_%d.txt' 
%(tempfile.gettempdir(),os.getppid())        

         if options.rerun: #deals with rerunning script with -r flag
             if not os.path.exists(rerun_path):
                 gpid = int(os.popen("ps -p %d -oppid=" % os.getppid()).read().strip())
-                rerun_gpid_path = '/%s/pyp_rerun_%d.txt' 
%(tempfile.gettempdir() ,gpid)
+                rerun_gpid_path = '%s/pyp_rerun_%d.txt' 
%(tempfile.gettempdir() ,gpid)
                 if os.path.exists(rerun_gpid_path):
                     rerun_path = rerun_gpid_path
                 else:




Original issue reported on code.google.com by niki...@gmail.com on 26 Jan 2013 at 4:10

Attachments:

@GoogleCodeExporter
Copy link
Author

Hi,

Thanks for checking this out.  This should be fixed in the beta version of pyp. 
 Please let me know if that doesn't work.  This is a stable release, and will 
be migrated to the main tree soon.

Original comment by tobyro...@gmail.com on 1 Feb 2013 at 5:37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant