basic help needed!

Sort:
strangequark

I am trying to run NFS factoring using msieve and I am encountering some problems with my command prompt. I am using instructions from http://gilchrist.ca/jeff/factoring/nfs_beginners_guide.html. I am able to acces the following from my command prompt:

cd C:\ggnfs\example\factMsieve.py

but I cannot get the following result to work despite that I have all of the files and folders needed in the required places:

"Windows users can start the factoring process with the factMsieve.py python script using this command in a Command Prompt from your working directory:
..\factMsieve.py example
UNIX users can start the factoring process using this command in a shell from your working directory:
../factMsieve.py example

This will call the msieve or pol51 tools to select a polynomial for the number in example.n. The output should look something like:"

All command prompt says is that the system cannot find the path specified. Did I miss something obvious or skip a step? Any help would be appreciated.

justjoshin

you either need to start the python interpreter, or pass the py script to it

 

so

type "python"

and you should see

>>>

then you can type your script name

 

or type "python script.py" to run it

 

if running the python interpreter fails, check to see if it's in your path, if not you can run it by specifying the full path on the command line.

c:\python\python myscript.py

strangequark

Hi justjoshin and thank you for your response. I was able to open a different prompt with python that showed >>>, but I had downloaded according to the instructions Python26 (C:Python26\python.exe was what the command screen showed). I tried specifying the script names you listed but it said invalid syntax, probably because I have a different version. What should I change the script name to?

justjoshin

so if you run

c:\python26\python.ex C:\ggnfs\example\factMsieve.py

what is the result?

strangequark

It says:

>>>C:\ggnfs\example\factMsieve.py

        File "<stdn>", line 1

            C:ggnfs\example\factMsieve.py

              [little arrow points up at ":" below "C:" here]

Syntax error: invalid syntax

>>>

justjoshin

can you specify it as a relative path to the script

"c:\python26\python.exe ..\factMsieve.py"

 

is that any better, i havn't used python in ages (and then it was on linux not windows so i'm probably not the best person to help, but i'll try :-)  )

strangequark

I tried cd C:\Python26\python.exe and adding ..\factMsieve.py but for some reason command prompt says both of those directory names are invalid. I can't imagine why, considering I can see the files in their places right in front of me. I apologize for this inconvenience!

justjoshin

if you are in the same dir as factMsieve.py then

"c:\python26\python.exe .\factMsieve.py" <- one dot not two( . not ..) as .. denotes the parent dir

justjoshin

you can't cd to c:\python26\python.exe

cd = change directory, so that is trying to change directory into an executable

cd to whereever you have factMsieve.py, then try

"c:\python26\python.exe .\factMsieve.py"

strangequark

Yes! I got something but it differs slightly from the example opened on the site I am following. I entered into command prompt:

C:\ggnfs\example\factMsieve.py.\factMsieve.py

->Running factmsieve.py, a python driver.... The box is the same as in my reference sight but thereafter it differs to:

"USAGE: C:ggnfs\example\factMsieve.py.\factMsieve.py <numberfile : polyfile :msieve poly file> [id num]

 where <polynomial file> is a file with the poly info to use or

 <number file> is a file containing the number to factor.

 Optional: id/num specifies that this is a client <id> of <num>" .....etc.

It didn't say that it found my example number that I had saved to factor like my reference did. Any more advice?

justjoshin

sounds like it should be passed in a file containing a number?

so say this file is num.txt

"C:\ggnfs\example\factMsieve.py num.txt" looks likely

strangequark

I tried C:\ggnfs\example\factMsieve.py example.n with limited success:

"Running factsieve.py, a Python driver....

->This is client 1 of 1...."

but then

"->Error: polynomial file example .poly does not exist! Cannot find example.poly siever terminated"

 

According to my reference sheet I should see something like:

"-> Error: Polynomial file example.poly does not exist!
-> Found n = 2881039827457895971881627053137530734638790825166127496066674320241571446494762386620442953820735453."

Perhaps I simply saved the txt file wrong when I wrote n: ... or is something else afoot?

justjoshin

is there a file called example.poly anywhere?

strangequark

I just called it "example.n" which contained the example number to factor because it was just what the guide said to do. I guess it may be noteworthy that that in the example it also said "-> Error: Polynomial file example.poly does not exist!", but it still went through. Unfortunately the situation is not as kind to me. Should I rename the file or edit it in some other way?

justjoshin

try renaming it to example.poly and see if it helps.

 

it seems to be expecting that file.

strangequark

I got using a different computer the following for many such entries so when I have access to my original computer I will try again.

"...:Warning: 'with' will become a reserved keyword in Python 2.6

   File "C:\ggnfs\example\factMsieve.py\factmsieve.py', line 196

     with open<file_path, 'r'> as in _file:

SyntaxError: invalid syntax"

I'll report back after I try it on my original computer although I can't imagine why there would be a difference considering I downloaded everything the same.

Kacparov

that ain't basic!