The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Using
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

spconway1987

11 Posts

Posted - 06/29/2015 :  09:51:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2015 Sr2
Operating System: Windows 8

Hello,

I'm trying to use urllib2 Python module and I'm getting a no module named urllib2 error. The module works from the command prompt so I know it's in my path but I'm curious if Origin is looking in its own package store or something? Any help as to why Origin isn't recognizing the module is greatly appreciated. This is my first post so apologies if this post isn't done correctly!

Edited by - spconway1987 on 06/29/2015 09:52:52 AM

Castiel

343 Posts

Posted - 06/29/2015 :  10:19:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by spconway1987

Origin Ver. and Service Release (Select Help-->About Origin): 2015 Sr2
Operating System: Windows 8

Hello,

I'm trying to use urllib2 Python module and I'm getting a no module named urllib2 error. The module works from the command prompt so I know it's in my path but I'm curious if Origin is looking in its own package store or something? Any help as to why Origin isn't recognizing the module is greatly appreciated. This is my first post so apologies if this post isn't done correctly!



Are you sure that you've switched to Python 2.7 in Origin? See the title of the script window, or check the system variable @pyv: @pyv = 3 suggests Python 3.x, and @pyv = 2 2.x.

As far as I can tell, on Windows 7, it looks in both the shipped packages and the ones in OS environment. Not sure about Windows 8. Check the sys.path after import sys.

If you are sure about the one used in Origin is Python 2.7, but fail again to import urllib2, have a try of this (given you have installed python 2.7 in C:\Python27:
import imp
imp.load_compiled('urllib2',r'C:\Python27\Lib\urllib2.pyc')



妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

spconway1987

11 Posts

Posted - 06/29/2015 :  11:17:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
When I keep script execution at Python 3 and use

from urllib.request import urlopen

it works so I think it's an issue with Origin and using Python 2.x. I have tried switching script execution to python 2.7 which produced the same module error. I am also getting a command error when I try your suggestion of using imp.load_compiled. Changing the system variable did not seem to work as well. I'm able to use Python 3 for what I am using Origin for so I will continue to use that. Thank you so much for your quick response!!
Go to Top of Page

AmandaLu

439 Posts

Posted - 06/30/2015 :  04:32:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi spconway1987,

I cannot reproduce the problem in win8. In fact you should try imp.load_source() rather than imp.load_compiled(). And when you tried imp.load_compiled(), what's the error message you got?

BTW, what's the Python version you installed? Origin uses Python 2.7.8.

Thanks,
Amanda
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000