Recovery deleted but running python script [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am running a python script python a.script on a linux box (I know all process information about it from /proc), but I accidentally run 'rm a.script', How can I recovery the script? I found this How do I determine the path to a binary of a process?, but I only found the python interpreter. How about lsof, but I have no idea about what to starts with.

The file itself is gone. You could only recover it by really tricky file system magic. There might be programs for specific file systems (like on DOS) which could recover the file on the disc ... but that is really bad file system trickery.
The other thing is, that the running script is also still in memory. But how could you recover that?? You could make a memory dump of course -- but I guess you only would get precompiled Python code -- and even that will not be easy to find. Get the source back from precompiled Python is not easy. Also you might not get a contiguous block of data, so it is really nearly impossible to get the coding back. At least your comments are really lost. But I would guess, getting back even some shady code without comments will be a task that is more costly than doing the coding again.
So, I regret to tell you: There is no chance, I see.

Related

How to run this Python program [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I know exactly 0 things about coding (unless HTML is coding?) and joined the site specifically for this question.
I found this code on Reddit and I'd really like to use the program, but I have zero knowledge of how to do that. I installed Python and have no idea how it works. I just need the very basic, click-this-button, type-this-here step-by-step of how to get an output and edit the variables.
The explanation of the program: https://www.reddit.com/r/worldbuilding/comments/1tpj38/random_royal_family_tree_generation/
The code is linked in the post but here it is again just in case: http://pastebin.com/uk9xG4XQ
I'm running Windows 10 and Python 3.5
Download the code in the python format (.py), open up PowerShell (comes with Windows 10), find your way to the directory you downloaded the .py format code to using the cd [X] command (where X is the directory), then type python3 X with X being whatever you saved the .py as.
If you're really eager to run the program without learning Python then do the following:
Download the file and save it as Dy27u.py
Open the file in notepad, find the line that says folder = '' #'/media/ToshikHD/Dropbox/Programming/Python/Dy/' and change the path to point to wherever you saved the file. Save the file, making sure you retain the .py extension
Open command prompt or powershell in Windows
Use cd to navigate to the folder where the file is stored. You make have to google this step to learn how to navigate around your file system if you don't already know hot do
Once you're in the correct directory, type python Dy27u.py
Taking a closer look at the code, you also need some extra text files called FemaleNames.txt, MaleNames.txt, and LastNames.txt. Read the comments in the .py file your downloaded so you know how to format those files

Python vs Perl for portability? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a large-ish project. I currently have some functional tests hacked together in shell scripts. They work, but I'd like to make them a little bit more complicated. I think it will be painful to do in bash, but easy in a full-blown scripting language. The target language of the project is not appropriate for implementing the tests.
I'm the only person who will be working on my branch for the foreseeable future, so it isn't a huge deal if my tests don't work for others. But I'd like to avoid committing code that's going to be useless to people working on this project in the future.
In terms of test harness "just working" for the largest number of current and future contributors to this project as possible, am I better off porting my shell scripts to Python or Perl?
I suspect Perl, since I know that the default version of Python installed (if any) varies widely across OSes, but I'm not sure if that's just because I'm less familiar with Perl.
Every modern Linux or Unixlike system comes with both installed; which you choose is a matter of taste. Just pick one.
I would say that whatever you choose, you should try to write easily-readable code in it, even if you're the only one who will be reading that code. Now, Pythonists will tell you that writing readable code is easier in Python, which may be true, but it's certainly doable in Perl as well.
This is more personal, but I always used python and will use it till something shows me it's better to use other. Its simple, very expansible, strong and fast and supported by a lot of users.
The version of python doesn't matter much since you can update it and most OSes have python 2.5 with expands the compatibility a lot. Perl is also included in Linux and Mac OS, though.
I think that Python will be good, but if you like perl and have always worked with it, just use perl and don't complicate your life.

Installing Python Canopy in Active Directory with a Mandnatory Profile [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
We are having difficulty installing our Python distribution in a way that will allow multiple users of the same computer to program in Python.
We switched the computers in our lab over to active directory with a mandatory profile. The problem is that Enthought Canopy puts several hundred MB of material in the profile itself. This makes it incredibly slow when a new user logs on. Can I get Canopy to install somewhere else, like a "normal" program?
Any help would be much appreciated, and I apologize if there is some obvious answer I am missing.

RSYNC compare folder to tarfile [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have googled a bit and it seems that you can not make an incremental backup of a folder when you compare it to the same folder in a tarformat.
I doubt that uncompressing the folder then rsycing it and recompressing the folder is a fast way to get the job done.
Do any of you have a workaround or alternative to rsync to solve this problem?
I am using cygwin on my Windows machine (at work) and cannot test the tar command, but I believe the file will be updated and you will NOT be left with two copies of the file. I know the zip command works:
zip -ru dest/test.tar src
I cannot comment on performance of zip vs tar vs rsync. If you have many many files this may become worth investigating.

Python Function Reference [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
There're tons of apps/widgets for PHP function reference and even for Ruby but I'm shocked to find there is nothing available for a popular language like Python (besides the official online documentation ofcourse).
Is there really not a single handy reference widget/app available for Python? I have 'Pocket Reference' book, but a dashboard widget would be so handy!
Python libraries have (or should have) built in documentation through docstrings. Also, python code is (mostly) very readable, and reading the source (.py or even .c) is actually the preferred way for many developers to get the information they're looking for, especially since some corner cases may not even be documented.
I've caught myself looking through the source now and then, as if it's a natural step in looking up functionality, either because I'm curious how they solve the problem, or because I reckon it's faster than googling obscure problems and reading SO questions.
So it's (often) not very pretty at all, but it's possible that the pydoc command line tool, or pydoc in webserver mode, could help you here. Here's an article on pydoc to help you get started
The interactive interpreter is a fantastic reference tool. dir(<identifier) lists all the attributes of a module, class, or function help(<identifier>) gives you help about same.
pydoc at the command line is another great tool. It does for Python what man gives you for commands, plus it even includes a web server you can start up to see the documentation in your browser.
I develop on Mac OS.
I have all the Python documentation directly available through a desktop app.
The app is called Safari. I bookmark http://docs.python.org/index.html
It's available as a desktop app.

Categories