Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Python- help running script


  • Please log in to reply
5 replies to this topic

#1 compudon

compudon

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:56 PM

Posted 17 August 2014 - 12:39 PM

I am trying to use this guide for converting Eudora mail to Gmail:

 

http://nerdfever.com/?p=2116

 

I get to the point where I need to run the first script called FixEudora7Mail.py. I have downloaded Python 3.4 and opened the command line.

 

I entered successfully:

import os 

os.chdir(‘E:\\eudora\settings’)

os.getcwd()

 

The output is correct:

 

‘e:\\eudora\settings’

>>>

 

So the working directory part is set and correct in python. Next I need to run a script that will modify these files in the ‘settings’ directory. The script files are .py and are unzipped in my desktop although I can move these to wherever I need to.

 

I have right clicked on the script file and chose OPEN WITH and chose PYTHON LAUNCHER FOR WINDOWS CONSOLE and the script begins to run (says Parsing…) but on the wrong directory. I closed it immediately.  It needs to modify files in the e:\\eudora\settings directory only.

 

So I have tried every command I know. What commands do I use to run the .py script in the command line window so it will modify the correct directory.

 

Also, once that is done I need to save/print the output as described in the guide site. How do I save the output so I know which files I need to delete/change per the guide?

 

Thanks so much in advance for any help you all may provide.

 

Compudon


Edited by compudon, 17 August 2014 - 01:26 PM.


BC AdBot (Login to Remove)

 


m

#2 Veitch

Veitch

  • Members
  • 31 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:09:56 PM

Posted 19 August 2014 - 10:02 AM

Start the script from the python interpreter right after you changed the working directory.

import os 
os.chdir(‘E:\\eudora\settings’)
os.getcwd() 
execfile(/'Path/To/FixEudora7Mail.py')

Replace Path/to/ with the real path.



#3 compudon

compudon
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:56 PM

Posted 02 September 2014 - 07:24 PM

Thank you. Sorry for the long delay in reply. I have been reading replies from 4 python forums who keep talking me in to not using the python command line (I assume the "interpreter" you are referring to).

 

I have read that execfile will not work with 3.0 python and above. Should I just download Python 2.7.8 and make it easy on myself?

 

 

Here is the path for the script file:

 

C:\Documents and Settings\NAME\Desktop\FixEudora7Mail.py

 

 

So the complete execfile command would be? (Sorry but I'm confused at the forward vs. back slashes in the command).

 

or

 

Can I just put a copy of FixEudora7Mail.py in the Eudora\Settings (working) directory and type:  execfile ('FixEudora7Mail.py')   ?

 

 

Thanks again,

Compudon



#4 compudon

compudon
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:56 PM

Posted 02 September 2014 - 08:52 PM

Veitch,

 

Downloaded 2.7.8. Opened shell GUI. Put a copy of the script fixeudora7mail.py in the working directory e:\eudora2\settings.

 

Below is copy of shell:

 

Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import os
>>> os.chdir('e:\eudora2\settings')
>>> os.getcwd
<built-in function getcwd>
>>> os.getcwd()
'e:\\eudora2\\settings'
>>> execfile fixeudora7mail.py
SyntaxError: invalid syntax
>>> execfile ('fixeudora7mail.py')
 
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    execfile ('fixeudora7mail.py')
  File "fixeudora7mail.py", line 17, in <module>
    from common import *
ImportError: No module named common
>>> 
 
 
Thank You,
Compudon


#5 Veitch

Veitch

  • Members
  • 31 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Local time:09:56 PM

Posted 03 September 2014 - 05:56 AM

Go to the site again: http://nerdfever.com/?p=2116

Download the zip folder with all four python scripts.

There is the common.py, which is obviously missing when you run the code above. You need all four files in the same folder.


Edited by Veitch, 03 September 2014 - 05:57 AM.


#6 compudon

compudon
  • Topic Starter

  • Members
  • 8 posts
  • OFFLINE
  •  
  • Local time:04:56 PM

Posted 06 September 2014 - 09:29 PM

Thanks for the reply. Unzipped all 4 script files into eudora2\settings.

 

Then tried windows xp command line:

 

Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.
 
C:\Documents and Settings\Don Spatola>e:
 
E:\>cd eudora2\settings
 
E:\Eudora2\Settings>d:\python34\python.exe fixeudora7mail.py
Parsing E:\Eudora2\Settings

Traceback (most recent call last):

  File "fixeudora7mail.py", line 363, in <module>
    main()
  File "fixeudora7mail.py", line 282, in main
    and (string.find(path, 'attach')) == -1 \
AttributeError: 'module' object has no attribute 'find'
 
E:\Eudora2\Settings>
 
 
Then tried Python Shell GUI with nerdfever site suggested method:
 
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> e:
 
SyntaxError: invalid syntax
>>> import os
>>> os.chdir('e:\eudora2\settings')
>>> os.chdir
<built-in function chdir>
>>> os.getcwd
<built-in function getcwd>
>>> os.getcwd()
'e:\\eudora2\\settings'
>>> python fixeudora7mail.py
SyntaxError: invalid syntax
>>> python ('fixeudora7mail.py')
 
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    python ('fixeudora7mail.py')
NameError: name 'python' is not defined
>>> python.exe ('fixeudora7mail.py')
 
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    python.exe ('fixeudora7mail.py')
NameError: name 'python' is not defined
>>> execfile('fixeudora7mail.py')
Parsing e:\eudora2\settings
 
Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    execfile('fixeudora7mail.py')
  File "fixeudora7mail.py", line 363, in <module>
    main()
  File "fixeudora7mail.py", line 291, in main
    displayName = map[name.lower() + ".mbx"]        # lookup display name for this file
UnboundLocalError: local variable 'map' referenced before assignment
>>> execfile(fixeudora7mail.py)
 
Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    execfile(fixeudora7mail.py)
NameError: name 'fixeudora7mail' is not defined
>>> 
 
Sorry about all the extra garbage....I was trying everything I could think of. The execfile command was suggested from another source but only works in 2.7.8.
 
Compudon





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users